diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py index adc98e70eab9923babca6cb59a6fa6fb9db2d80e..a382b08feb40b2de9c1104ab8befdbd1b5285963 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py @@ -196,7 +196,7 @@ class DraftModuleStore(MongoModuleStore): # b/c we don't want the payload, I'm copying the guts of get_items here query = self._course_key_to_son(dest_course_id) query['_id.category'] = {'$nin': ['course', 'about']} - if self.collection.find(query).limit(1).count() > 0: + if self.collection.count_documents(query, limit=1) > 0: raise DuplicateCourseError( dest_course_id, "Course at destination {0} is not an empty course. " diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py index 1861ef3b824595a72b158827407b195e4e343b20..c0559a4c64a9be43b9ad8bf48affc47b65100882 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py @@ -2235,12 +2235,12 @@ class TestSchema(SplitModuleTest): db_connection = modulestore().db_connection for collection in [db_connection.course_index, db_connection.structures, db_connection.definitions]: self.assertEqual( - collection.find({'schema_version': {'$exists': False}}).count(), + collection.count_documents({'schema_version': {'$exists': False}}), 0, "{0.name} has records without schema_version".format(collection) ) self.assertEqual( - collection.find({'schema_version': {'$ne': SplitMongoModuleStore.SCHEMA_VERSION}}).count(), + collection.count_documents({'schema_version': {'$ne': SplitMongoModuleStore.SCHEMA_VERSION}}), 0, "{0.name} has records with wrong schema_version".format(collection) )