Permalink
Browse files

geo2d command -> geoNear

  • Loading branch information...
1 parent a347ce9 commit da23ec8f562fa04eb3c4c24055accc7c3d8576fe @erh erh committed Feb 26, 2010
Showing with 10 additions and 10 deletions.
  1. +1 −1 db/index_geo2d.cpp
  2. +2 −2 jstests/geo2.js
  3. +4 −4 jstests/geo3.js
  4. +3 −3 jstests/geo5.js
View
@@ -859,7 +859,7 @@ namespace mongo {
class Geo2dFindNearCmd : public Command {
public:
- Geo2dFindNearCmd() : Command( "geo2d" ){}
+ Geo2dFindNearCmd() : Command( "geoNear" ){}
virtual LockType locktype(){ return READ; }
bool slaveOk() { return true; }
bool slaveOverrideOk() { return true; }
View
@@ -11,8 +11,8 @@ for ( var x=-100; x<100; x+=2 ){
t.ensureIndex( { loc : "2d" } )
-fast = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 } );
-slow = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 , start : "11" } );
+fast = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 } );
+slow = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 , start : "11" } );
printjson(fast.stats);
printjson(slow.stats);
View
@@ -12,11 +12,11 @@ for ( var x=-100; x<100; x+=2 ){
t.ensureIndex( { loc : "2d" } )
-fast = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 } );
+fast = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 } );
//printjson( fast.stats );
-slow = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 , start : "11" } );
+slow = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 , start : "11" } );
//printjson( slow.stats );
@@ -26,15 +26,15 @@ assert.eq( fast.stats.avgDistance , slow.stats.avgDistance , "A3" );
// test filter
-filtered1 = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 , query : { a : 2 } } );
+filtered1 = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 , query : { a : 2 } } );
assert.eq( 10 , filtered1.results.length , "B1" );
filtered1.results.forEach( function(z){ assert.eq( 2 , z.obj.a , "B2: " + tojson( z ) ); } )
//printjson( filtered1.stats );
t.dropIndex( { loc : "2d" } )
t.ensureIndex( { loc : "2d" , a : 1 } )
-filtered2 = db.runCommand( { geo2d : t.getName() , near : [ 50 , 50 ] , num : 10 , query : { a : 2 } } );
+filtered2 = db.runCommand( { geoNear : t.getName() , near : [ 50 , 50 ] , num : 10 , query : { a : 2 } } );
assert.eq( 10 , filtered2.results.length , "B3" );
filtered2.results.forEach( function(z){ assert.eq( 2 , z.obj.a , "B4: " + tojson( z ) ); } )
//printjson( filtered2.stats );
View
@@ -4,15 +4,15 @@ t.drop();
t.insert( { p : [ 0,0 ] } )
t.ensureIndex( { p : "2d" } )
-res = t.runCommand( "geo2d" , { near : [1,1] } );
+res = t.runCommand( "geoNear" , { near : [1,1] } );
assert.eq( 1 , res.results.length , "A1" );
t.insert( { p : [ 1,1 ] } )
t.insert( { p : [ -1,-1 ] } )
-res = t.runCommand( "geo2d" , { near : [50,50] } );
+res = t.runCommand( "geoNear" , { near : [50,50] } );
assert.eq( 3 , res.results.length , "A2" );
t.insert( { p : [ -1,-1 ] } )
-res = t.runCommand( "geo2d" , { near : [50,50] } );
+res = t.runCommand( "geoNear" , { near : [50,50] } );
assert.eq( 4 , res.results.length , "A3" );

0 comments on commit da23ec8

Please sign in to comment.