Fix merge of PR #747

This commit is contained in:
Yohan Graterol 2014-08-27 11:14:43 -05:00
commit bce7ca7ac4
2 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ Changelog
Changes in 0.9.X - DEV Changes in 0.9.X - DEV
====================== ======================
- Allow specifying the '_cls' as a field for indexes #397 - Allow specifying the '_cls' as a field for indexes #397
- Stop ensure_indexes running on a secondaries unless connection is through mongos #746
- Not overriding default values when loading a subset of fields #399 - Not overriding default values when loading a subset of fields #399
- Saving document doesn't create new fields in existing collection #620 - Saving document doesn't create new fields in existing collection #620
- Added `Queryset.aggregate` wrapper to aggregation framework #703 - Added `Queryset.aggregate` wrapper to aggregation framework #703

View File

@ -594,7 +594,9 @@ class Document(BaseDocument):
index_cls = cls._meta.get('index_cls', True) index_cls = cls._meta.get('index_cls', True)
collection = cls._get_collection() collection = cls._get_collection()
if collection.read_preference > 1: # 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:
return return
# determine if an index which we are creating includes # determine if an index which we are creating includes