diff options
author | gregs <greg@10gen.com> | 2011-07-14 11:29:16 -0400 |
---|---|---|
committer | gregs <greg@10gen.com> | 2011-07-14 11:36:08 -0400 |
commit | 9134b167029adbe8682190854b88755929b14914 (patch) | |
tree | 0462d61bf105abdcc685e0f29b16729b2e3be6de | |
parent | e6299cf1d1dd63ebda4fd4cd2a7e52de21c8a90a (diff) | |
download | mongo-9134b167029adbe8682190854b88755929b14914.tar.gz |
test case for SERVER-3428
-rw-r--r-- | jstests/geo_update.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/jstests/geo_update.js b/jstests/geo_update.js new file mode 100644 index 00000000000..dd4b28c8374 --- /dev/null +++ b/jstests/geo_update.js @@ -0,0 +1,37 @@ +// Tests geo queries w/ update & upsert +// from SERVER-3428 + +var coll = db.testGeoUpdate +coll.drop() + +coll.ensureIndex({ loc : "2d" }) + +// Test normal update +print( "Updating..." ) + +coll.insert({ loc : [1.0, 2.0] }) + +coll.update({ loc : { $near : [1.0, 2.0] } }, + { x : true, loc : [1.0, 2.0] }) + +// Test upsert +print( "Upserting..." ) + +coll.update({ loc : { $within : { $center : [[10, 20], 1] } } }, + { x : true }, + true) + +coll.update({ loc : { $near : [10.0, 20.0], $maxDistance : 1 } }, + { x : true }, + true) + + +coll.update({ loc : { $near : [100, 100], $maxDistance : 1 } }, + { $set : { loc : [100, 100] }, $push : { people : "chris" } }, + true) + +coll.update({ loc : { $near : [100, 100], $maxDistance : 1 } }, + { $set : { loc : [100, 100] }, $push : { people : "john" } }, + true) + +assert.eq( 4, coll.find().itcount() ) |