summaryrefslogtreecommitdiff
path: root/jstests/libs/profiler.js
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2016-11-15 16:17:19 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2017-03-15 11:03:44 -0400
commit584ca76de9ee66b3e11987e640f5317ae40975e4 (patch)
treedb52f1717155c295437f1b4fa41a5db295183669 /jstests/libs/profiler.js
parentf05b9437fbdc53deecf55ed3c20e36af3d733953 (diff)
downloadmongo-584ca76de9ee66b3e11987e640f5317ae40975e4.tar.gz
SERVER-22541 Manage aggregation cursors on global cursor manager.
Moves registration of aggregation cursors to the global cursor manager. This simplifies the logic for acquiring locks and resolving view namespaces within the getMore and killCursors commands.
Diffstat (limited to 'jstests/libs/profiler.js')
-rw-r--r--jstests/libs/profiler.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/jstests/libs/profiler.js b/jstests/libs/profiler.js
index c0fc210c928..5d94050d775 100644
--- a/jstests/libs/profiler.js
+++ b/jstests/libs/profiler.js
@@ -2,8 +2,14 @@
// Retrieve latest system.profile entry.
function getLatestProfilerEntry(inputDb, filter) {
- var cursor = inputDb.system.profile.find(filter === null ? {} : filter);
- return cursor.sort({$natural: -1}).next();
+ if (filter === null) {
+ filter = {};
+ }
+ var cursor = inputDb.system.profile.find(filter).sort({$natural: -1});
+ assert(
+ cursor.hasNext(),
+ "could not find any entries in the profile collection matching filter: " + tojson(filter));
+ return cursor.next();
}
// Returns a string representing the wire protocol used for commands run on the given connection.
@@ -23,4 +29,4 @@ function profilerHasSingleMatchingEntryOrThrow(inputDb, filter, errorMsgFilter,
1,
"Expected exactly one op matching: " + tojson(filter) + " in profiler " +
tojson(inputDb.system.profile.find(errorMsgFilter, errorMsgProj).toArray()));
-} \ No newline at end of file
+}