| 220 | """ |
| 221 | |
| 222 | def __init__(self, alias=DEFAULT_CONNECTION_NAME): |
| 223 | self.db = get_db(alias=alias) |
| 224 | self.initial_profiling_level = None |
| 225 | self._ctx_query_counter = 0 # number of queries issued by the context |
| 226 | |
| 227 | self._ignored_query = { |
| 228 | "ns": {"$ne": "%s.system.indexes" % self.db.name}, |
| 229 | "op": {"$ne": "killcursors"}, # MONGODB < 3.2 |
| 230 | "command.killCursors": {"$exists": False}, # MONGODB >= 3.2 |
| 231 | } |
| 232 | |
| 233 | def _turn_on_profiling(self): |
| 234 | profile_update_res = self.db.command({"profile": 0}) |