Permalink
Browse files

Merge pull request #118 from mpobrien/master

Allow option to db.current_op() to include idle connections PYTHON-340
  • Loading branch information...
2 parents 6ecb615 + 4f3fb62 commit 63785530a993523148c67e8c7c665b57e9a83309 @behackett behackett committed Apr 6, 2012
Showing with 12 additions and 3 deletions.
  1. +12 −3 pymongo/database.py
View
@@ -451,10 +451,19 @@ def validate_collection(self, name_or_collection,
return result
- def current_op(self):
+ def current_op(self, include_all=False):
"""Get information on operations currently running.
- """
- return self['$cmd.sys.inprog'].find_one()
+
+ :Parameters:
+ - `include_all` (optional): if ``True`` also list currently
+ idle operations in the result
+ """
+ if include_idle:
+ return self['$cmd.sys.inprog'].find_one({"$all":True},
+ _is_command=True)
+ else:
+ return self['$cmd.sys.inprog'].find_one()
+
def profiling_level(self):
"""Get the database's current profiling level.

0 comments on commit 6378553

Please sign in to comment.