diff options
Diffstat (limited to 'jstests/in9.js')
-rw-r--r-- | jstests/in9.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/in9.js b/jstests/in9.js new file mode 100644 index 0000000..34cefb8 --- /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(); |