0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/geo_sort1.js
Eliot Horowitz b31047a12f v8 sort
2010-11-16 09:56:00 -05:00

23 lines
436 B
JavaScript

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" );
a.sort();
b.sort();
assert.eq( a , b , "B" );