Terminate Running Operations
New in version 2.6.
mongo shell, use the following method to set a time limit of 30 milliseconds for this query:
Consider a potentially long running operation using
distinct to return each distinct
collection field that has a
You can add the
maxTimeMS field to the command document to set a time limit of 45 milliseconds for the operation:
Terminate running operations with extreme caution. Only use
db.killOp() to terminate operations initiated by clients and do not terminate internal database operations.