From 23cbe7d09c0370d61367c1da65ab4a944370edd1 Mon Sep 17 00:00:00 2001 From: Kristina Date: Fri, 10 Feb 2012 13:47:10 -0500 Subject: Added array of success/failures to applyOps output SERVER-4259 --- jstests/apply_ops1.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'jstests/apply_ops1.js') 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" ); -- cgit v1.2.1