Add flag to create_collection to skip listCollections pre-check. For example:
>>> client.db.create_collection("name") Collection(...) >>> client.db.create_collection("name") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/shane/git/mongo-python-driver/pymongo/database.py", line 378, in create_collection raise CollectionInvalid("collection %s already exists" % name) pymongo.errors.CollectionInvalid: collection name already exists >>> client.db.create_collection("name", check_exists=False) Collection(...)
Motivation:
- spec tests assume that drivers do not call listCollections in the createCollection helper. Our current behavior requires workarounds in the spec runner to ignore the listCollections command.
- This gives us a path to change the default createCollection behavior (to check_exists=False) in pymongo 5.0.
- I think we made the wrong decision in
PYTHON-1936. We should have introduced this option in 3.x and changed the behavior in 4.0.
Note the name of the flag is TBD, check_exists might end up being the final name but it's only an example.
- related to
-
PYTHON-1936 Remove listCollections check from Database.create_collection
- Closed
-
PYTHON-3241 Add FLE 2 API to AutoEncryptionOpts
- Closed