refactored deprecated pymongo methods in tests

- remove/count/add_user/insert
- added pymongo_support
This commit is contained in:
Bastien Gérard
2019-02-24 11:08:46 +01:00
parent c60c2ee8d0
commit 35b7efe3f4
17 changed files with 106 additions and 79 deletions

View File

@@ -18,7 +18,7 @@ from mongoengine.context_managers import (set_write_concern,
switch_db)
from mongoengine.errors import (InvalidDocumentError, InvalidQueryError,
SaveConditionError)
from mongoengine.python_support import IS_PYMONGO_3
from mongoengine.pymongo_support import IS_PYMONGO_3, list_collection_names
from mongoengine.queryset import (NotUniqueError, OperationError,
QuerySet, transform)
@@ -228,7 +228,7 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
# If the collection already exists and has different options
# (i.e. isn't capped or has different max/size), raise an error.
if collection_name in db.collection_names():
if collection_name in list_collection_names(db, include_system_collections=True):
collection = db[collection_name]
options = collection.options()
if (