diff --git a/mongoengine/document.py b/mongoengine/document.py index 2de0b1a3..865bb063 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -854,7 +854,7 @@ class Document(BaseDocument): collection = cls._get_collection() # 746: when connection is via mongos, the read preference is not necessarily an indication that # this code runs on a secondary - if not collection.is_mongos and collection.read_preference > 1: + if not collection.database.client.is_mongos and collection.read_preference > 1: return # determine if an index which we are creating includes