diff options
author | Matthew Russotto <matthew.russotto@10gen.com> | 2017-12-20 13:37:47 -0500 |
---|---|---|
committer | Matthew Russotto <matthew.russotto@10gen.com> | 2017-12-20 13:37:47 -0500 |
commit | 55be4faf62882b1b6b7313aa87acf393ef9fddcd (patch) | |
tree | 4f197336e11b547b7c58e7381da1b4c983152105 /jstests/core/bypass_doc_validation.js | |
parent | b3033d477f2356d17a0e5263775a0e2dfce75ede (diff) | |
download | mongo-55be4faf62882b1b6b7313aa87acf393ef9fddcd.tar.gz |
SERVER-32162 Create a doTxn command
Diffstat (limited to 'jstests/core/bypass_doc_validation.js')
-rw-r--r-- | jstests/core/bypass_doc_validation.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/jstests/core/bypass_doc_validation.js b/jstests/core/bypass_doc_validation.js index 6a9bbde8ffc..74bddec627d 100644 --- a/jstests/core/bypass_doc_validation.js +++ b/jstests/core/bypass_doc_validation.js @@ -6,6 +6,7 @@ * - aggregation with $out * - applyOps (when not sharded) * - copyDb + * - doTxn (when not sharded) * - findAndModify * - insert * - mapReduce @@ -39,8 +40,9 @@ assert.writeOK(coll.insert({_id: 2})); assert.commandWorked(myDb.runCommand({collMod: collName, validator: validator})); + const isMongos = db.runCommand({isdbgrid: 1}).isdbgrid; // Test applyOps with a simple insert if not on mongos. - if (!db.runCommand({isdbgrid: 1}).isdbgrid) { + if (!isMongos) { const op = [{h: 1, v: 2, op: 'i', ns: coll.getFullName(), o: {_id: 9}}]; assertFailsValidation(myDb.runCommand({applyOps: op, bypassDocumentValidation: false})); assert.eq(0, coll.count({_id: 9})); @@ -48,6 +50,15 @@ assert.eq(1, coll.count({_id: 9})); } + // Test doTxn with a simple insert if not on mongos. + if (!isMongos) { + const op = [{h: 1, v: 2, op: 'i', ns: coll.getFullName(), o: {_id: 10}}]; + assertFailsValidation(myDb.runCommand({doTxn: op, bypassDocumentValidation: false})); + assert.eq(0, coll.count({_id: 10})); + assert.commandWorked(myDb.runCommand({doTxn: op, bypassDocumentValidation: true})); + assert.eq(1, coll.count({_id: 10})); + } + // Test the aggregation command with a $out stage. const outputCollName = 'bypass_output_coll'; const outputColl = myDb[outputCollName]; |