summaryrefslogtreecommitdiff
path: root/jstests/in9.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2011-03-24 23:01:36 -0700
committerAaron <aaron@10gen.com>2011-03-25 11:31:11 -0700
commit02162fa52bccc9314aed2a7f78caee78149d7d7f (patch)
tree205deb1916edfade1d4247228c58e76047fe2bca /jstests/in9.js
parent131ba64314adb5236af84f9f6a0690c588f83f32 (diff)
downloadmongo-02162fa52bccc9314aed2a7f78caee78149d7d7f.tar.gz
SERVER-2343 SERVER-1943 test
Diffstat (limited to 'jstests/in9.js')
-rw-r--r--jstests/in9.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/in9.js b/jstests/in9.js
new file mode 100644
index 00000000000..b0d70b6a4fc
--- /dev/null
+++ b/jstests/in9.js
@@ -0,0 +1,35 @@
+// SERVER-2343 Test $in empty array matching.
+
+t = db.jstests_in9;
+t.drop();
+
+function someData() {
+ t.remove();
+ t.save( {key: []} );
+}
+
+function moreData() {
+ someData();
+ t.save( {key: [1]} );
+ t.save( {key: ['1']} );
+ t.save( {key: null} );
+ t.save( {} );
+}
+
+function check() {
+ assert.eq( 1, t.count( {key:[]} ) );
+ assert.eq( 1, t.count( {key:{$in:[[]]}} ) );
+}
+
+function doTest() {
+ someData();
+ check();
+ moreData();
+ check();
+}
+
+doTest();
+
+// SERVER-1943 not fixed yet
+//t.ensureIndex( {key:1} );
+//doTest();