summaryrefslogtreecommitdiff
path: root/jstests/geo_box2.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-19 14:00:46 -0400
committerEliot Horowitz <eliot@10gen.com>2010-03-19 14:00:46 -0400
commita1da8961abc17cef7564d42ca1b95c0ba8b45fa5 (patch)
tree893d0548498225b5e8731e6ce2b4147c2fb49524 /jstests/geo_box2.js
parentfc5ec754da83f740c8e14dcd7ce3239272b3094a (diff)
downloadmongo-a1da8961abc17cef7564d42ca1b95c0ba8b45fa5.tar.gz
fix $box corner cases SERVER-791
Diffstat (limited to 'jstests/geo_box2.js')
-rw-r--r--jstests/geo_box2.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/geo_box2.js b/jstests/geo_box2.js
new file mode 100644
index 00000000000..2aa65d0ccb0
--- /dev/null
+++ b/jstests/geo_box2.js
@@ -0,0 +1,19 @@
+
+t = db.geo_box2;
+
+t.drop()
+
+for (i=1; i<10; i++) {
+ for(j=1; j<10; j++) {
+ t.insert({loc : [i,j]});
+ }
+}
+
+t.ensureIndex({"loc" : "2d"} )
+assert.eq( 9 , t.find({loc : {$within : {$box : [[4,4],[6,6]]}}}).itcount() , "A1" );
+
+t.dropIndex( { "loc" : "2d" } )
+
+t.ensureIndex({"loc" : "2d"} , {"min" : 0, "max" : 10})
+assert.eq( 9 , t.find({loc : {$within : {$box : [[4,4],[6,6]]}}}).itcount() , "B1" );
+