From 95137f262c2a57831dccf058428a2f64e900496e Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 28 Dec 2009 15:45:29 -0500 Subject: [PATCH] more tests for SERVER-181 --- jstests/updatea.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/jstests/updatea.js b/jstests/updatea.js index d6495d2186f..9864aa67889 100644 --- a/jstests/updatea.js +++ b/jstests/updatea.js @@ -30,5 +30,21 @@ orig.comments[0].rate_up++; orig.comments[0].rate_ups.push( 99 ) assert.eq( orig , t.findOne() , "B1" ) +t.drop(); +orig = { _id : 1 , a : [] } +for ( i=0; i<12; i++ ) + orig.a.push( i ); + + +t.save( orig ); +assert.eq( orig , t.findOne() , "C1" ); + +t.update( {} , { $inc: { "a.0" : 1 } } ); +orig.a[0]++; +assert.eq( orig , t.findOne() , "C2" ); + +t.update( {} , { $inc: { "a.10" : 1 } } ); +orig.a[10]++; +