mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
sparse geo index
This commit is contained in:
parent
0c9f391212
commit
346a47331c
@ -248,6 +248,8 @@ namespace mongo {
|
||||
BSONObjBuilder b(64);
|
||||
|
||||
BSONElement geo = obj[_geo];
|
||||
if ( geo.eoo() )
|
||||
return;
|
||||
uassert( 13025 , (string)"geo field[" + _geo + "] has to be an Object or Array" , geo.isABSONObj() );
|
||||
b.append( "" , _hash( geo.embeddedObject() ) );
|
||||
|
||||
|
13
jstests/geo6.js
Normal file
13
jstests/geo6.js
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
t = db.geo6;
|
||||
t.drop();
|
||||
|
||||
t.ensureIndex( { loc : "2d" } );
|
||||
|
||||
t.insert( { _id : 1 , loc : [ 1 , 1 ] } )
|
||||
t.insert( { _id : 2 , loc : [ 1 , 2 ] } )
|
||||
t.insert( { _id : 3 } )
|
||||
|
||||
assert.eq( 3 , t.find().itcount() , "A1" )
|
||||
assert.eq( 2 , t.find().hint( { loc : "2d" } ).itcount() , "A2" )
|
||||
assert.eq( 2 , t.find( { loc : { $near : [50,50] } } ).itcount() , "A3" )
|
Loading…
Reference in New Issue
Block a user