Improvements to indexes and efficiencies
Thanks to @dcrosta for the patches closes #225
This commit is contained in:
parent
a2b0266e01
commit
2a8d001213
@ -320,7 +320,7 @@ class QuerySet(object):
|
|||||||
providing :class:`~mongoengine.Document` objects as the results.
|
providing :class:`~mongoengine.Document` objects as the results.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ALREADY_INDEXED = set()
|
__already_indexed = set()
|
||||||
|
|
||||||
def __init__(self, document, collection):
|
def __init__(self, document, collection):
|
||||||
self._document = document
|
self._document = document
|
||||||
@ -468,8 +468,8 @@ class QuerySet(object):
|
|||||||
"""Property that returns the collection object. This allows us to
|
"""Property that returns the collection object. This allows us to
|
||||||
perform operations only if the collection is accessed.
|
perform operations only if the collection is accessed.
|
||||||
"""
|
"""
|
||||||
if self._document not in QuerySet.ALREADY_INDEXED:
|
if self._document not in QuerySet.__already_indexed:
|
||||||
QuerySet.ALREADY_INDEXED.add(self._document)
|
QuerySet.__already_indexed.add(self._document)
|
||||||
|
|
||||||
background = self._document._meta.get('index_background', False)
|
background = self._document._meta.get('index_background', False)
|
||||||
drop_dups = self._document._meta.get('index_drop_dups', False)
|
drop_dups = self._document._meta.get('index_drop_dups', False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user