diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-02-11 11:36:08 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-02-11 11:36:08 -0500 |
commit | c9ed60974d3a795a25353f3790d6af6093bfad3d (patch) | |
tree | 58645be3da883ec089c3289318b73a269ea25dbd /jstests/set6.js | |
parent | 7935d23cca442aa696fd266b2339bc46d9d838bf (diff) | |
download | mongo-c9ed60974d3a795a25353f3790d6af6093bfad3d.tar.gz |
fix upsert for DBRef SERVER-627
Diffstat (limited to 'jstests/set6.js')
-rw-r--r-- | jstests/set6.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/jstests/set6.js b/jstests/set6.js new file mode 100644 index 00000000000..d41e7aba971 --- /dev/null +++ b/jstests/set6.js @@ -0,0 +1,20 @@ + +t = db.set6; +t.drop(); + +x = { _id : 1 , r : new DBRef( "foo" , new ObjectId() ) } +t.insert( x ) +assert.eq( x , t.findOne() , "A" ); + +x.r.$id = new ObjectId() +t.update({}, { $set : { r : x.r } } ); +assert.eq( x , t.findOne() , "B"); + +x.r2 = new DBRef( "foo2" , 5 ) +t.update( {} , { $set : { "r2" : x.r2 } } ); +assert.eq( x , t.findOne() , "C" ) + +x.r.$id = 2; +t.update( {} , { $set : { "r.$id" : 2 } } ) +assert.eq( x.r.$id , t.findOne().r.$id , "D"); + |