diff options
author | Jason Rassi <rassi@10gen.com> | 2014-07-30 15:12:11 -0400 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2014-07-30 16:12:02 -0400 |
commit | 13fe3b061fa3c5970c40973d6f36f69fa06130a5 (patch) | |
tree | 22f051cf09c9c64149f68580aa001b0195983ef0 /jstests | |
parent | 76be742def16b4081e559374d66ede6a00cf3ff0 (diff) | |
download | mongo-13fe3b061fa3c5970c40973d6f36f69fa06130a5.tar.gz |
SERVER-14498 Add DeleteStage, rewrite DeleteExecutor to use it
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/stages_delete.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/jstests/core/stages_delete.js b/jstests/core/stages_delete.js new file mode 100644 index 00000000000..f8c7fd14ea1 --- /dev/null +++ b/jstests/core/stages_delete.js @@ -0,0 +1,27 @@ +// Test basic delete stage functionality. +var coll = db.stages_delete; +var collScanStage = {cscan: {args: {direction: 1}, filter: {deleteMe: true}}}; +var deleteStage; + +// Test delete stage with isMulti: true. +coll.drop(); +assert.writeOK(coll.insert({deleteMe: true})); +assert.writeOK(coll.insert({deleteMe: true})); +assert.writeOK(coll.insert({deleteMe: false})); +deleteStage = {delete: {args: {node: collScanStage, isMulti: true, shouldCallLogOp: true}}}; +assert.eq(coll.count(), 3); +assert.commandWorked(db.runCommand({stageDebug: {collection: coll.getName(), plan: deleteStage}})); +assert.eq(coll.count(), 1); +assert.eq(coll.count({deleteMe: false}), 1); + +// Test delete stage with isMulti: false. +coll.drop(); +assert.writeOK(coll.insert({deleteMe: true})); +assert.writeOK(coll.insert({deleteMe: true})); +assert.writeOK(coll.insert({deleteMe: false})); +deleteStage = {delete: {args: {node: collScanStage, isMulti: false, shouldCallLogOp: true}}}; +assert.eq(coll.count(), 3); +assert.commandWorked(db.runCommand({stageDebug: {collection: coll.getName(), plan: deleteStage}})); +assert.eq(coll.count(), 2); +assert.eq(coll.count({deleteMe: true}), 1); +assert.eq(coll.count({deleteMe: false}), 1); |