From d3420918cd9804243900c8566b7e155044e668cb Mon Sep 17 00:00:00 2001 From: Eloi Zalczer Date: Mon, 18 Nov 2019 17:16:06 +0100 Subject: [PATCH] Added alias parameter in query_counter --- mongoengine/context_managers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoengine/context_managers.py b/mongoengine/context_managers.py index d8dfeaac..5920b724 100644 --- a/mongoengine/context_managers.py +++ b/mongoengine/context_managers.py @@ -182,10 +182,10 @@ class query_counter(object): - Some queries are ignored by default by the counter (killcursors, db.system.indexes) """ - def __init__(self): + def __init__(self, alias=DEFAULT_CONNECTION_NAME): """Construct the query_counter """ - self.db = get_db() + self.db = get_db(alias=alias) self.initial_profiling_level = None self._ctx_query_counter = 0 # number of queries issued by the context