MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / _get_count

Method _get_count

mongoengine/context_managers.py:276–288  ·  view source on GitHub ↗

Get the number of queries by counting the current number of entries in db.system.profile and substracting the queries issued by this context. In fact everytime this is called, 1 query is issued so we need to balance that

(self)

Source from the content-addressed store, hash-verified

274 return "%s" % self._get_count()
275
276 def _get_count(self):
277 """Get the number of queries by counting the current number of entries in db.system.profile
278 and substracting the queries issued by this context. In fact everytime this is called, 1 query is
279 issued so we need to balance that
280 """
281 count = (
282 count_documents(self.db.system.profile, self._ignored_query)
283 - self._ctx_query_counter
284 )
285 self._ctx_query_counter += (
286 1 # Account for the query we just issued to gather the information
287 )
288 return count
289
290
291@contextmanager

Callers 7

__eq__Method · 0.95
__lt__Method · 0.95
__le__Method · 0.95
__gt__Method · 0.95
__ge__Method · 0.95
__int__Method · 0.95
__repr__Method · 0.95

Calls 1

count_documentsFunction · 0.90

Tested by

no test coverage detected