diff options
Diffstat (limited to 'jstests/core/update_arraymatch4.js')
-rw-r--r-- | jstests/core/update_arraymatch4.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/jstests/core/update_arraymatch4.js b/jstests/core/update_arraymatch4.js index d445168ca25..fabe07f7337 100644 --- a/jstests/core/update_arraymatch4.js +++ b/jstests/core/update_arraymatch4.js @@ -2,17 +2,18 @@ t = db.update_arraymatch4; t.drop(); -x = { _id : 1 , arr : ["A1","B1","C1"] }; -t.insert( x ); -assert.eq( x , t.findOne() , "A1" ); +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.update({arr: "A1"}, {$set: {"arr.$": "A2"}}); +assert.eq(x, t.findOne(), "A2"); -t.ensureIndex( { arr : 1 } ); +t.ensureIndex({arr: 1}); x.arr[0] = "A3"; -t.update( { arr : "A2" } , { $set : { "arr.$" : "A3" } } ); -assert.eq( x , t.findOne() , "A3" ); // SERVER-1055 - - +t.update({arr: "A2"}, {$set: {"arr.$": "A3"}}); +assert.eq(x, t.findOne(), "A3"); // SERVER-1055 |