Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for hints to find().

Add debug printing of query spec to find().
  • Loading branch information...
commit 52c1ac819c3a7606caddee9c3d9d5070ad28f789 1 parent 0b0d48f
Nathan Folkman authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 asyncmongo/cursor.py
View
8 asyncmongo/cursor.py
@@ -269,7 +269,7 @@ def find_one(self, spec_or_id, **kwargs):
def find(self, spec=None, fields=None, skip=0, limit=0,
timeout=True, snapshot=False, tailable=False, sort=None,
max_scan=None, slave_okay=False,
- _must_use_master=False, _is_command=False,
+ _must_use_master=False, _is_command=False, hint=None, debug=False,
callback=None):
"""Query the database.
@@ -366,7 +366,8 @@ def find(self, spec=None, fields=None, skip=0, limit=0,
self.__max_scan = max_scan
self.__slave_okay = slave_okay
self.__explain = False
- self.__hint = None
+ self.__hint = hint
+ self.__debug = debug
# self.__as_class = as_class
self.__tz_aware = False #collection.database.connection.tz_aware
self.__must_use_master = _must_use_master
@@ -374,6 +375,9 @@ def find(self, spec=None, fields=None, skip=0, limit=0,
connection = self.__pool.connection()
try:
+ if self.__debug:
+ print u'QUERY_SPEC: {}'.format(self.__query_spec())
+
connection.send_message(
message.query(self.__query_options(),
self.full_collection_name,
Please sign in to comment.
Something went wrong with that request. Please try again.