Browse files

test for SERVER-795

  • Loading branch information...
1 parent f69f94c commit d74909dfc0a78fec4f650f692cd7665f2d46a3a5 @erh erh committed Mar 22, 2010
Showing with 24 additions and 0 deletions.
  1. +24 −0 jstests/geoc.js
View
24 jstests/geoc.js
@@ -0,0 +1,24 @@
+
+t = db.geoc;
+t.drop()
+
+N = 1000;
+
+for (var i=0; i<N; i++) t.insert({loc:[100+Math.random(), 100+Math.random()], z:0})
+for (var i=0; i<N; i++) t.insert({loc:[0+Math.random(), 0+Math.random()], z:1})
+for (var i=0; i<N; i++) t.insert({loc:[-100+Math.random(), -100+Math.random()], z:2})
+
+t.ensureIndex({loc:'2d'})
+
+function test( z , l ){
+ assert.lt( 0 , t.find({loc:{$near:[100,100]}, z:z}).limit(l).itcount() , "z: " + z + " l: " + l );
+}
+
+test( 1 , 1 );
+test( 1 , 2 );
+test( 2 , 2 );
+test( 2 , 10 );
+test( 2 , 1000 );
+test( 2 , 100000 );
+test( 2 , 10000000 );
+

0 comments on commit d74909d

Please sign in to comment.