Merge pull request #1799 from erdenezul/ensure_indexes_fails_on_slave
Ensure indexes fails on slave #1338
This commit is contained in:
commit
758971e068
@ -14,6 +14,7 @@ dev
|
|||||||
- Use new update_one, update_many on document/queryset update #1491
|
- Use new update_one, update_many on document/queryset update #1491
|
||||||
- Use insert_one, insert_many in Document.insert #1491
|
- Use insert_one, insert_many in Document.insert #1491
|
||||||
- Fix reload(fields) affect changed fields #1371
|
- Fix reload(fields) affect changed fields #1371
|
||||||
|
- Fix Read-only access to database fails when trying to create indexes #1338
|
||||||
|
|
||||||
Changes in 0.15.0
|
Changes in 0.15.0
|
||||||
=================
|
=================
|
||||||
|
@ -195,7 +195,10 @@ class Document(BaseDocument):
|
|||||||
|
|
||||||
# Ensure indexes on the collection unless auto_create_index was
|
# Ensure indexes on the collection unless auto_create_index was
|
||||||
# set to False.
|
# set to False.
|
||||||
if cls._meta.get('auto_create_index', True):
|
# Also there is no need to ensure indexes on slave.
|
||||||
|
db = cls._get_db()
|
||||||
|
if cls._meta.get('auto_create_index', True) and\
|
||||||
|
db.client.is_primary:
|
||||||
cls.ensure_indexes()
|
cls.ensure_indexes()
|
||||||
|
|
||||||
return cls._collection
|
return cls._collection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user