summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/aggregation_log_namespace.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/aggregation_log_namespace.js')
-rw-r--r--jstests/noPassthrough/aggregation_log_namespace.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/jstests/noPassthrough/aggregation_log_namespace.js b/jstests/noPassthrough/aggregation_log_namespace.js
index 274bbc3d0d0..ef7fe89d126 100644
--- a/jstests/noPassthrough/aggregation_log_namespace.js
+++ b/jstests/noPassthrough/aggregation_log_namespace.js
@@ -5,6 +5,7 @@
'use strict';
load("jstests/aggregation/extras/merge_helpers.js"); // For withEachKindOfWriteStage.
+load("jstests/libs/logv2_helpers.js");
// Runs the given 'pipeline' and verifies that the namespace is correctly logged in the global
// log for the aggregate command. The 'comment' parameter is used to match a log entry against
@@ -12,11 +13,20 @@ load("jstests/aggregation/extras/merge_helpers.js"); // For withEachKindOfWrite
function verifyLoggedNamespace({pipeline, comment}) {
assert.commandWorked(db.runCommand(
{aggregate: source.getName(), comment: comment, pipeline: pipeline, cursor: {}}));
- checkLog.containsWithCount(
- conn,
- `command ${source.getFullName()} appName: "MongoDB Shell" ` +
- `command: aggregate { aggregate: "${source.getName()}", comment: "${comment}"`,
- 1);
+ if (isJsonLogNoConn()) {
+ checkLog.containsWithCount(
+ conn,
+ `"appName":"MongoDB Shell",` +
+ `"command":{"aggregate":"${source.getName()}","comment":"${comment}"`,
+ 1);
+
+ } else {
+ checkLog.containsWithCount(
+ conn,
+ `command ${source.getFullName()} appName: "MongoDB Shell" ` +
+ `command: aggregate { aggregate: "${source.getName()}", comment: "${comment}"`,
+ 1);
+ }
}
const mongodOptions = {};