summaryrefslogtreecommitdiff
path: root/jstests/geo_update3.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/geo_update3.js')
-rw-r--r--jstests/geo_update3.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/jstests/geo_update3.js b/jstests/geo_update3.js
new file mode 100644
index 00000000000..f885b2f660f
--- /dev/null
+++ b/jstests/geo_update3.js
@@ -0,0 +1,17 @@
+// Updates are applied once per location to a document with multiple locations iterated
+// consecutively. This is a descriptive, not a normative test. SERVER-5885
+
+t = db.jstests_geo_update3;
+t.drop();
+
+t.ensureIndex( { loc:'2d' } );
+// Save a document with two locations.
+t.save( { loc:[ [ 0, 0 ], [ 1, 1 ] ] } );
+
+// The update matches both locations without deduping them.
+t.update( { loc:{ $within:{ $center:[ [ 0, 0 ], 2 ], $uniqueDocs:false } } },
+ { $inc:{ touchCount:1 } }, false, true );
+
+// The document is updated twice.
+assert.eq( 2, db.getLastErrorObj().n );
+assert.eq( 2, t.findOne().touchCount );