summaryrefslogtreecommitdiff
path: root/jstests/find_and_modify2.js
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2010-08-11 12:38:57 +0200
committerAntonin Kral <a.kral@bobek.cz>2010-08-11 12:38:57 +0200
commit7645618fd3914cb8a20561625913c20d49504a49 (patch)
tree8370f846f58f6d71165b7a0e2eda04648584ec76 /jstests/find_and_modify2.js
parent68c73c3c7608b4c87f07440dc3232801720b1168 (diff)
downloadmongodb-7645618fd3914cb8a20561625913c20d49504a49.tar.gz
Imported Upstream version 1.6.0
Diffstat (limited to 'jstests/find_and_modify2.js')
-rw-r--r--jstests/find_and_modify2.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/jstests/find_and_modify2.js b/jstests/find_and_modify2.js
new file mode 100644
index 0000000..108fc0f
--- /dev/null
+++ b/jstests/find_and_modify2.js
@@ -0,0 +1,10 @@
+t = db.find_and_modify2;
+t.drop();
+
+t.insert({_id:1, i:0, j:0});
+
+out = t.findAndModify({update: {$inc: {i:1}}, 'new': true, fields: {i:1}});
+assert.eq(out, {_id:1, i:1});
+
+out = t.findAndModify({update: {$inc: {i:1}}, fields: {i:0}});
+assert.eq(out, {_id:1, j:0});