Skip to content

insert_one signature does not match pymongo #831

Open

Description

@tysonholub

Latest version of pymongo has an optional comment param in the insert_one signature https://github.com/mongodb/mongo-python-driver/blob/a3720d9ceaa699e196fc1624f4c62515c2e5410d/pymongo/collection.py#L578.

Code that uses this parameter will crash when tested with mongomock

>       return self.db_col.insert_one(
            document=document, bypass_document_validation=bypass_document_validation, session=session, comment=comment
        )
E       TypeError: Collection.insert_one() got an unexpected keyword argument 'comment'

Activity

  1. tysonholub commented on Feb 10, 2023

    @tysonholub
    Author

    Some other signatures that do not match:
    delete_one: missing let and comment in mongomock
    update_one: missing comment in mongomock
    find: accepts kwargs in the mongomock signature, but it looks like any truthy kwarg values will raise OperationFailure. comment and max are just a couple I noticed that are not explicitly accepted.

    for kwarg, value in kwargs.items():
    if value:
    raise OperationFailure("Unrecognized field '%s'" % kwarg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions