Permalink
Browse files

test for SERVER-1821

  • Loading branch information...
erh committed Sep 24, 2010
1 parent 829a5e9 commit f8da5e06860a0d5e0fd7b5637fcc748127cfbcc3
Showing with 38 additions and 0 deletions.
  1. +38 −0 jstests/geo_update1.js
View
@@ -0,0 +1,38 @@
+
+t = db.geo_update1
+t.drop()
+
+for(var x = 0; x < 10; x++ ) {
+ for(var y = 0; y < 10; y++ ) {
+ t.insert({"loc": [x, y] , x : x , y : y , z : 1 });
+ }
+}
+
+t.ensureIndex( { loc : "2d" } )
+
+function p(){
+ print( "--------------" );
+ for ( var y=0; y<10; y++ ){
+ var c = t.find( { y : y } ).sort( { x : 1 } )
+ var s = "";
+ while ( c.hasNext() )
+ s += c.next().z + " ";
+ print( s )
+ }
+ print( "--------------" );
+}
+
+p()
+
+t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'z' : 1}}, false, true);
+assert.isnull( db.getLastError() , "B1" )
+p()
+
+t.update({}, {'$inc' : { 'z' : 1}}, false, true);
+assert.isnull( db.getLastError() , "B2" )
+p()
+
+
+t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'z' : 1}}, false, true);
+assert.isnull( db.getLastError() , "B3" )
+p()

0 comments on commit f8da5e0

Please sign in to comment.