0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/geo_sort1.js

23 lines
436 B
JavaScript
Raw Normal View History

2010-11-15 18:14:37 +01:00
t = db.geo_sort1
t.drop();
for ( x=0; x<10; x++ ){
for ( y=0; y<10; y++ ){
t.insert( { loc : [ x , y ] , foo : x * x * y } );
}
}
t.ensureIndex( { loc : "2d" , foo : 1 } )
q = t.find( { loc : { $near : [ 5 , 5 ] } , foo : { $gt : 20 } } )
m = function(z){ return z.foo; }
a = q.clone().map( m );
b = q.clone().sort( { foo : 1 } ).map( m );
assert.neq( a , b , "A" );
2010-11-16 15:56:00 +01:00
a.sort();
b.sort();
2010-11-15 18:14:37 +01:00
assert.eq( a , b , "B" );