(self, document, collection)
| 53 | """ |
| 54 | |
| 55 | def __init__(self, document, collection): |
| 56 | self._document = document |
| 57 | self._collection_obj = collection |
| 58 | self._mongo_query = None |
| 59 | self._query_obj = Q() |
| 60 | self._cls_query = {} |
| 61 | self._where_clause = None |
| 62 | self._loaded_fields = QueryFieldList() |
| 63 | self._ordering = None |
| 64 | self._snapshot = False |
| 65 | self._timeout = True |
| 66 | self._allow_disk_use = False |
| 67 | self._read_preference = None |
| 68 | self._read_concern = None |
| 69 | self._iter = False |
| 70 | self._scalar = [] |
| 71 | self._none = False |
| 72 | self._as_pymongo = False |
| 73 | self._search_text = None |
| 74 | self._search_text_score = None |
| 75 | |
| 76 | self.__dereference = False |
| 77 | self.__auto_dereference = True |
| 78 | |
| 79 | # If inheritance is allowed, only return instances and instances of |
| 80 | # subclasses of the class being used |
| 81 | if document._meta.get("allow_inheritance") is True: |
| 82 | if len(self._document._subclasses) == 1: |
| 83 | self._cls_query = {"_cls": self._document._subclasses[0]} |
| 84 | else: |
| 85 | self._cls_query = {"_cls": {"$in": self._document._subclasses}} |
| 86 | self._loaded_fields = QueryFieldList(always_include=["_cls"]) |
| 87 | |
| 88 | self._cursor_obj = None |
| 89 | self._limit = None |
| 90 | self._skip = None |
| 91 | |
| 92 | self._hint = -1 # Using -1 as None is a valid value for hint |
| 93 | self._collation = None |
| 94 | self._batch_size = None |
| 95 | self._max_time_ms = None |
| 96 | self._comment = None |
| 97 | |
| 98 | # Hack - As people expect cursor[5:5] to return |
| 99 | # an empty result set. It's hard to do that right, though, because the |
| 100 | # server uses limit(0) to mean 'no limit'. So we set _empty |
| 101 | # in that case and check for it when iterating. We also unset |
| 102 | # it anytime we change _limit. Inspired by how it is done in pymongo.Cursor |
| 103 | self._empty = False |
| 104 | |
| 105 | def __call__(self, q_obj=None, **query): |
| 106 | """Filter the selected documents by calling the |
nothing calls this directly
no test coverage detected