dont send a "cls" option to ensureIndex (related to https://jira.mongodb.org/browse/SERVER-769)

This commit is contained in:
Stefan Wojcik
2015-05-06 11:25:45 +02:00
parent d9c8285806
commit 9bdc320cf8
4 changed files with 72 additions and 2 deletions

View File

@@ -677,6 +677,12 @@ class Document(BaseDocument):
cls_indexed = cls_indexed or includes_cls(fields)
opts = index_opts.copy()
opts.update(spec)
# we shouldn't pass 'cls' to the collection.ensureIndex options
# because of https://jira.mongodb.org/browse/SERVER-769
if 'cls' in opts:
del opts['cls']
collection.ensure_index(fields, background=background,
drop_dups=drop_dups, **opts)
@@ -684,6 +690,12 @@ class Document(BaseDocument):
# only if another index doesn't begin with _cls
if (index_cls and not cls_indexed and
cls._meta.get('allow_inheritance', ALLOW_INHERITANCE) is True):
# we shouldn't pass 'cls' to the collection.ensureIndex options
# because of https://jira.mongodb.org/browse/SERVER-769
if 'cls' in index_opts:
del index_opts['cls']
collection.ensure_index('_cls', background=background,
**index_opts)