Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #118 from mpobrien/master

Allow option to db.current_op() to include idle connections PYTHON-340
  • Loading branch information...
commit 63785530a993523148c67e8c7c665b57e9a83309 2 parents 6ecb615 + 4f3fb62
@behackett behackett authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 pymongo/database.py
View
15 pymongo/database.py
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.