diff options
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/drop2.js | 6 | ||||
-rw-r--r-- | jstests/geo_update.js | 37 | ||||
-rw-r--r-- | jstests/index_fornew.js | 13 | ||||
-rw-r--r-- | jstests/slowNightly/sharding_balance4.js | 4 |
4 files changed, 55 insertions, 5 deletions
diff --git a/jstests/drop2.js b/jstests/drop2.js index fa239fd..a1d619d 100644 --- a/jstests/drop2.js +++ b/jstests/drop2.js @@ -2,7 +2,7 @@ t = db.jstests_drop2; t.drop(); function debug( x ) { -// printjson( x ); + //printjson( x ); } t.save( {} ); @@ -14,11 +14,11 @@ function op( drop ) { for ( var i in p ) { var o = p[ i ]; if ( drop ) { - if ( o.active && o.query && o.query.drop && o.query.drop == "jstests_drop2" ) { + if ( o.query && o.query.drop && o.query.drop == "jstests_drop2" ) { return o.opid; } } else { - if ( o.active && o.query && o.query.query && o.query.query.$where && o.ns == "test.jstests_drop2" ) { + if ( o.query && o.query.query && o.query.query.$where && o.ns == "test.jstests_drop2" ) { return o.opid; } } diff --git a/jstests/geo_update.js b/jstests/geo_update.js new file mode 100644 index 0000000..dd4b28c --- /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() ) diff --git a/jstests/index_fornew.js b/jstests/index_fornew.js new file mode 100644 index 0000000..6c3c158 --- /dev/null +++ b/jstests/index_fornew.js @@ -0,0 +1,13 @@ + +t = db.index_fornew; +t.drop(); + +t.insert( { x : 1 } ) +t.ensureIndex( { x : 1 } , { v : 1 } ) +assert.eq( 1 , t.getIndexes()[1].v , tojson( t.getIndexes() ) ); + +assert.throws( function(){ t.findOne( { x : 1 } ); } ) + +t.reIndex(); +assert.eq( 0 , t.getIndexes()[1].v , tojson( t.getIndexes() ) ); +assert( t.findOne( { x : 1 } ) ); diff --git a/jstests/slowNightly/sharding_balance4.js b/jstests/slowNightly/sharding_balance4.js index 4cbbba6..c7f76dd 100644 --- a/jstests/slowNightly/sharding_balance4.js +++ b/jstests/slowNightly/sharding_balance4.js @@ -90,8 +90,8 @@ function diff(){ if ( le.err ) print( "ELIOT ELIOT : " + tojson( le ) + "\t" + myid ); - assert( le.updatedExisting , "GLE diff 1: " + tojson(le) ) - assert.eq( 1 , le.n , "GLE diff 2: " + tojson(le) ) + assert( le.updatedExisting , "GLE diff 1 myid: " + myid + " " + tojson(le) ) + assert.eq( 1 , le.n , "GLE diff 2 myid: " + myid + " " + tojson(le) ) if ( Math.random() > .99 ){ |