2010-02-24 19:15:17 +01:00
|
|
|
t = db.geo5;
|
|
|
|
t.drop();
|
|
|
|
|
|
|
|
t.insert( { p : [ 0,0 ] } )
|
|
|
|
t.ensureIndex( { p : "2d" } )
|
|
|
|
|
2010-02-26 20:40:09 +01:00
|
|
|
res = t.runCommand( "geoNear" , { near : [1,1] } );
|
2010-02-24 19:15:17 +01:00
|
|
|
assert.eq( 1 , res.results.length , "A1" );
|
|
|
|
|
2010-02-24 19:57:16 +01:00
|
|
|
t.insert( { p : [ 1,1 ] } )
|
|
|
|
t.insert( { p : [ -1,-1 ] } )
|
2010-02-26 20:40:09 +01:00
|
|
|
res = t.runCommand( "geoNear" , { near : [50,50] } );
|
2010-02-24 19:57:16 +01:00
|
|
|
assert.eq( 3 , res.results.length , "A2" );
|
|
|
|
|
|
|
|
t.insert( { p : [ -1,-1 ] } )
|
2010-02-26 20:40:09 +01:00
|
|
|
res = t.runCommand( "geoNear" , { near : [50,50] } );
|
2010-02-24 19:57:16 +01:00
|
|
|
assert.eq( 4 , res.results.length , "A3" );
|
|
|
|
|