diff options
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/list_collections1.js | 9 | ||||
-rw-r--r-- | jstests/core/list_collections_filter.js | 6 | ||||
-rw-r--r-- | jstests/core/rename_stayTemp.js | 8 | ||||
-rw-r--r-- | jstests/core/txns/prepare_transaction_fails_on_temp_collections.js | 9 |
4 files changed, 22 insertions, 10 deletions
diff --git a/jstests/core/list_collections1.js b/jstests/core/list_collections1.js index 33377c2db97..ddc563cf852 100644 --- a/jstests/core/list_collections1.js +++ b/jstests/core/list_collections1.js @@ -1,6 +1,7 @@ // Cannot implicitly shard accessed collections because of collection existing when none // expected. -// @tags: [assumes_no_implicit_collection_creation_after_drop, requires_getmore] +// @tags: [assumes_no_implicit_collection_creation_after_drop, requires_getmore, +// requires_replication] // Basic functional tests for the listCollections command. // @@ -82,7 +83,8 @@ assert.commandWorked(mydb.dropDatabase()); assert.commandWorked(mydb.createCollection("foo")); - assert.commandWorked(mydb.createCollection("bar", {temp: true})); + assert.commandWorked(mydb.runCommand( + {applyOps: [{op: "c", ns: mydb.getName() + ".$cmd", o: {create: "bar", temp: true}}]})); assert.eq(1, cursorCountMatching(getListCollectionsCursor(), function(c) { return c.name === "foo" && c.options.temp === undefined; })); @@ -96,7 +98,8 @@ assert.commandWorked(mydb.dropDatabase()); assert.commandWorked(mydb.createCollection("foo")); - assert.commandWorked(mydb.createCollection("bar", {temp: true})); + assert.commandWorked(mydb.runCommand( + {applyOps: [{op: "c", ns: mydb.getName() + ".$cmd", o: {create: "bar", temp: true}}]})); assert.eq(2, cursorCountMatching(getListCollectionsCursor({filter: {}}), function(c) { return c.name === "foo" || c.name === "bar"; })); diff --git a/jstests/core/list_collections_filter.js b/jstests/core/list_collections_filter.js index ef162642bdf..fdd1c85429c 100644 --- a/jstests/core/list_collections_filter.js +++ b/jstests/core/list_collections_filter.js @@ -1,4 +1,5 @@ // Test SERVER-18622 listCollections should special case filtering by name. +// @tags: [requires_replication] (function() { "use strict"; var mydb = db.getSiblingDB("list_collections_filter"); @@ -8,7 +9,10 @@ assert.commandWorked(mydb.createCollection("lists")); assert.commandWorked(mydb.createCollection("ordered_sets")); assert.commandWorked(mydb.createCollection("unordered_sets")); - assert.commandWorked(mydb.createCollection("arrays_temp", {temp: true})); + assert.commandWorked(mydb.runCommand({ + applyOps: + [{op: "c", ns: mydb.getName() + ".$cmd", o: {create: "arrays_temp", temp: true}}] + })); /** * Asserts that the names of the collections returned from running the listCollections diff --git a/jstests/core/rename_stayTemp.js b/jstests/core/rename_stayTemp.js index b31c8319d88..d2d514b0d23 100644 --- a/jstests/core/rename_stayTemp.js +++ b/jstests/core/rename_stayTemp.js @@ -1,4 +1,4 @@ -// @tags: [requires_non_retryable_commands] +// @tags: [requires_non_retryable_commands, requires_replication] orig = 'rename_stayTemp_orig'; dest = 'rename_stayTemp_dest'; @@ -18,7 +18,8 @@ function istemp(name) { return collections[0].options.temp ? true : false; } -db.runCommand({create: orig, temp: 1}); +assert.commandWorked( + db.runCommand({applyOps: [{op: "c", ns: db.getName() + ".$cmd", o: {create: orig, temp: 1}}]})); assert(istemp(orig)); db.adminCommand({renameCollection: ns(orig), to: ns(dest)}); @@ -26,7 +27,8 @@ assert(!istemp(dest)); db[dest].drop(); -db.runCommand({create: orig, temp: 1}); +assert.commandWorked( + db.runCommand({applyOps: [{op: "c", ns: db.getName() + ".$cmd", o: {create: orig, temp: 1}}]})); assert(istemp(orig)); db.adminCommand({renameCollection: ns(orig), to: ns(dest), stayTemp: true}); diff --git a/jstests/core/txns/prepare_transaction_fails_on_temp_collections.js b/jstests/core/txns/prepare_transaction_fails_on_temp_collections.js index ac752e37074..3b23266daf9 100644 --- a/jstests/core/txns/prepare_transaction_fails_on_temp_collections.js +++ b/jstests/core/txns/prepare_transaction_fails_on_temp_collections.js @@ -4,7 +4,7 @@ * Transactions should not operate on temporary collections because they are for internal use only * and are deleted on both repl stepup and server startup. * - * @tags: [uses_transactions, uses_prepare_transaction] + * @tags: [uses_transactions, uses_prepare_transaction, requires_replication] */ (function() { @@ -17,8 +17,11 @@ testTempColl.drop({writeConcern: {w: "majority"}}); - jsTest.log("Creating a temporary collection ({temp:true})."); - assert.commandWorked(testDB.createCollection(tempCollName, {temp: true})); + jsTest.log("Creating a temporary collection."); + assert.commandWorked(testDB.runCommand({ + applyOps: + [{op: "c", ns: testDB.getName() + ".$cmd", o: {create: tempCollName, temp: true}}] + })); const session = db.getMongo().startSession(); const sessionDB = session.getDatabase(dbName); |