sbdchd / mongo-types

:fallen_leaf: Type stubs for mongoengine, pymongo, and bson
Apache License 2.0
19 stars 8 forks source link

`upsert` missing from `replace_one` #68

Open gusutabopb opened 1 year ago

gusutabopb commented 1 year ago

As of pymongo 4.3.3 the Collection.replace_one method has the upsert parameter, but it's missing from the stub definitions:

https://github.com/sbdchd/mongo-types/blob/main/pymongo-stubs/collection.pyi#L76

    def replace_one(
        self,
        filter: Mapping[str, Any],
        replacement: Mapping[str, Any],
        bypass_document_validation: bool = ...,
        collation: Optional[Collation] = ...,
        hint: Optional[Any] = ...,
        session: Optional[ClientSession] = ...,
    ) -> UpdateResult: ...

This leads to the following false positive from mypy (v0.991):

error: Unexpected keyword argument "upsert" for "replace_one" of "Collection"  [call-arg]