summaryrefslogtreecommitdiff
path: root/jstests/core/geo_update2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/geo_update2.js')
-rw-r--r--jstests/core/geo_update2.js43
1 files changed, 20 insertions, 23 deletions
diff --git a/jstests/core/geo_update2.js b/jstests/core/geo_update2.js
index f2f1b6cee4b..ffcf02617be 100644
--- a/jstests/core/geo_update2.js
+++ b/jstests/core/geo_update2.js
@@ -2,38 +2,35 @@
t = db.geo_update2;
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 });
- }
-}
-
-t.ensureIndex( { loc : "2d" } );
-
-function p(){
- print( "--------------" );
- for ( var y=0; y<10; y++ ){
- var c = t.find( { y : y } ).sort( { x : 1 } );
+for (var x = 0; x < 10; x++) {
+ for (var y = 0; y < 10; y++) {
+ t.insert({"loc": [x, y], x: x, y: y});
+ }
+}
+
+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() )
+ while (c.hasNext())
s += c.next().z + " ";
- print( s );
+ print(s);
}
- print( "--------------" );
+ print("--------------");
}
p();
-
-assert.writeOK(t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}},
- {'$inc' : { 'z' : 1}}, false, true));
+assert.writeOK(
+ t.update({"loc": {"$within": {"$center": [[5, 5], 2]}}}, {'$inc': {'z': 1}}, false, true));
p();
-assert.writeOK(t.update({}, {'$inc' : { 'z' : 1}}, false, true));
+assert.writeOK(t.update({}, {'$inc': {'z': 1}}, false, true));
p();
-
-assert.writeOK(t.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}},
- {'$inc' : { 'z' : 1}}, false, true));
+assert.writeOK(
+ t.update({"loc": {"$within": {"$center": [[5, 5], 2]}}}, {'$inc': {'z': 1}}, false, true));
p();
-