summaryrefslogtreecommitdiff
path: root/jstests/arrayfind4.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2011-07-31 08:44:33 -0700
committerAaron <aaron@10gen.com>2011-07-31 08:51:44 -0700
commitec1ea9cfaa71557ed8df2ea42e5acef5c1a169f2 (patch)
treec1b88ba26f3b90ecf673f21da80c83d207d48ab8 /jstests/arrayfind4.js
parent0141015c83c0fc70f5bb40c55ed62e21aab0cfb7 (diff)
downloadmongo-ec1ea9cfaa71557ed8df2ea42e5acef5c1a169f2.tar.gz
SERVER-2258 test
Diffstat (limited to 'jstests/arrayfind4.js')
-rw-r--r--jstests/arrayfind4.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/arrayfind4.js b/jstests/arrayfind4.js
new file mode 100644
index 00000000000..b141425f2e9
--- /dev/null
+++ b/jstests/arrayfind4.js
@@ -0,0 +1,22 @@
+// Test query empty array SERVER-2258
+
+t = db.jstests_arrayfind4;
+t.drop();
+
+t.save( {a:[]} );
+t.ensureIndex( {a:1} );
+
+assert.eq( 1, t.find( {a:[]} ).hint( {$natural:1} ).itcount() );
+assert.eq( 1, t.find( {a:[]} ).hint( {a:1} ).itcount() );
+
+assert.eq( 1, t.find( {a:{$in:[[]]}} ).hint( {$natural:1} ).itcount() );
+assert.eq( 1, t.find( {a:{$in:[[]]}} ).hint( {a:1} ).itcount() );
+
+t.remove();
+t.save( {a:[[]]} );
+
+assert.eq( 1, t.find( {a:[]} ).hint( {$natural:1} ).itcount() );
+assert.eq( 1, t.find( {a:[]} ).hint( {a:1} ).itcount() );
+
+assert.eq( 1, t.find( {a:{$in:[[]]}} ).hint( {$natural:1} ).itcount() );
+assert.eq( 1, t.find( {a:{$in:[[]]}} ).hint( {a:1} ).itcount() );