Files
mongo/jstests/core/update_arraymatch4.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

19 lines
399 B
JavaScript

t = db.update_arraymatch4
t.drop()
x = { _id : 1 , arr : ["A1","B1","C1"] }
t.insert( x )
assert.eq( x , t.findOne() , "A1" )
x.arr[0] = "A2"
t.update( { arr : "A1" } , { $set : { "arr.$" : "A2" } } )
assert.eq( x , t.findOne() , "A2" )
t.ensureIndex( { arr : 1 } )
x.arr[0] = "A3"
t.update( { arr : "A2" } , { $set : { "arr.$" : "A3" } } )
assert.eq( x , t.findOne() , "A3" ); // SERVER-1055