summaryrefslogtreecommitdiff
path: root/jstests/set7.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-03-01 23:58:24 -0800
committerAaron <aaron@10gen.com>2010-03-01 23:58:24 -0800
commit6a95b558e12a9a13f3ca9dcdd6590d9d30f7990d (patch)
treeeb92b3154dd505e23027c431d2d76fb967ab0815 /jstests/set7.js
parent262374df1d435dc730f0957b81d76ed75a2c7bab (diff)
downloadmongo-6a95b558e12a9a13f3ca9dcdd6590d9d30f7990d.tar.gz
SERVER-652 basic support for set with indexed elements
Diffstat (limited to 'jstests/set7.js')
-rw-r--r--jstests/set7.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/set7.js b/jstests/set7.js
new file mode 100644
index 00000000000..a79ff6e40c0
--- /dev/null
+++ b/jstests/set7.js
@@ -0,0 +1,15 @@
+// test $set with array indicies
+
+t = db.jstests_set7;
+
+t.drop();
+
+t.save( {a:[0,1,2,3]} );
+t.update( {}, {$set:{"a.0":2}} );
+assert.eq( [2,1,2,3], t.findOne().a );
+
+t.update( {}, {$set:{"a.4":5}} );
+assert.eq( [2,1,2,3,5], t.findOne().a );
+
+t.update( {}, {$set:{"a.9":9}} );
+assert.eq( [2,1,2,3,5,null,null,null,null,9], t.findOne().a ); \ No newline at end of file