diff options
author | Kristina <kristina@10gen.com> | 2012-02-10 13:47:10 -0500 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-02-13 10:28:13 -0500 |
commit | 23cbe7d09c0370d61367c1da65ab4a944370edd1 (patch) | |
tree | 7aa1b39d422c8bda29c0a3d3defcbe8c8ec5a824 /jstests/apply_ops1.js | |
parent | 2d8237e652e2875fb829e9604f79fccb1643f241 (diff) | |
download | mongo-23cbe7d09c0370d61367c1da65ab4a944370edd1.tar.gz |
Added array of success/failures to applyOps output SERVER-4259
Diffstat (limited to 'jstests/apply_ops1.js')
-rw-r--r-- | jstests/apply_ops1.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/jstests/apply_ops1.js b/jstests/apply_ops1.js index adfcc27b640..194dc90b909 100644 --- a/jstests/apply_ops1.js +++ b/jstests/apply_ops1.js @@ -3,8 +3,9 @@ t = db.apply_ops1; t.drop(); assert.eq( 0 , t.find().count() , "A0" ); -db.runCommand( { applyOps : [ { "op" : "i" , "ns" : t.getFullName() , "o" : { _id : 5 , x : 17 } } ] } ) -assert.eq( 1 , t.find().count() , "A1" ); +a = db.runCommand( { applyOps : [ { "op" : "i" , "ns" : t.getFullName() , "o" : { _id : 5 , x : 17 } } ] } ) +assert.eq( 1 , t.find().count() , "A1a" ); +assert.eq( true, a.results[0], "A1b" ); o = { _id : 5 , x : 17 } assert.eq( o , t.findOne() , "A2" ); @@ -19,6 +20,8 @@ o.x++; assert.eq( 1 , t.find().count() , "A3" ); assert.eq( o , t.findOne() , "A4" ); +assert.eq( true, res.results[0], "A1b" ); +assert.eq( true, res.results[1], "A1b" ); res = db.runCommand( { applyOps : @@ -35,17 +38,28 @@ o.x++; assert.eq( 1 , t.find().count() , "B1" ); assert.eq( o , t.findOne() , "B2" ); +assert.eq( true, res.results[0], "B2a" ); +assert.eq( true, res.results[1], "B2b" ); -res = db.runCommand( { applyOps : - [ +res = db.runCommand( { applyOps : + [ { "op" : "u" , "ns" : t.getFullName() , "o2" : { _id : 5 } , "o" : { $inc : { x : 1 } } } , - { "op" : "u" , "ns" : t.getFullName() , "o2" : { _id : 5 } , "o" : { $inc : { x : 1 } } } + { "op" : "u" , "ns" : t.getFullName() , "o2" : { _id : 5 } , "o" : { $inc : { x : 1 } } } ] - , + , preCondition : [ { ns : t.getFullName() , q : { _id : 5 } , res : { x : 19 } } ] } ); assert.eq( 1 , t.find().count() , "B3" ); assert.eq( o , t.findOne() , "B4" ); +res = db.runCommand( { applyOps : + [ + { "op" : "u" , "ns" : t.getFullName() , "o2" : { _id : 5 } , "o" : { $inc : { x : 1 } } } , + { "op" : "u" , "ns" : t.getFullName() , "o2" : { _id : 6 } , "o" : { $inc : { x : 1 } } } + ] + } ); + +assert.eq( true, res.results[0], "B5" ); +assert.eq( false, res.results[1], "B6" ); |