summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-22 14:02:30 -0400
committerEliot Horowitz <eliot@10gen.com>2010-03-22 14:02:30 -0400
commitd74909dfc0a78fec4f650f692cd7665f2d46a3a5 (patch)
tree8ed54b8536467f76d56c988ad447ced3bed28def /jstests
parentf69f94cbb4eed4a8b8cc49f32e0272d06e8e351f (diff)
downloadmongo-d74909dfc0a78fec4f650f692cd7665f2d46a3a5.tar.gz
test for SERVER-795
Diffstat (limited to 'jstests')
-rw-r--r--jstests/geoc.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/geoc.js b/jstests/geoc.js
new file mode 100644
index 00000000000..8b0178095e8
--- /dev/null
+++ b/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 );
+