We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3654591 commit 446c101Copy full SHA for 446c101
mongoengine/document.py
@@ -195,7 +195,9 @@ def _get_collection(cls):
195
196
# Ensure indexes on the collection unless auto_create_index was
197
# set to False.
198
- if cls._meta.get('auto_create_index', True):
+ # Also there is no need to ensure indexes on slave.
199
+ if cls._meta.get('auto_create_index', True) and\
200
+ db.client.is_primary:
201
cls.ensure_indexes()
202
203
return cls._collection
0 commit comments