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)
| 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 |