mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
24 lines
647 B
JavaScript
24 lines
647 B
JavaScript
// SERVER-2829 Test arrays matching themselves within a $in expression.
|
|
|
|
t = db.jstests_in8;
|
|
t.drop();
|
|
|
|
t.save( {key: [1]} );
|
|
t.save( {key: ['1']} );
|
|
t.save( {key: [[2]]} );
|
|
|
|
function doTest() {
|
|
assert.eq( 1, t.count( {key:[1]} ) );
|
|
assert.eq( 1, t.count( {key:{$in:[[1]]}} ) );
|
|
assert.eq( 1, t.count( {key:{$in:[[1]],$ne:[2]}} ) );
|
|
assert.eq( 1, t.count( {key:{$in:[['1']],$type:2}} ) );
|
|
assert.eq( 1, t.count( {key:['1']} ) );
|
|
assert.eq( 1, t.count( {key:{$in:[['1']]}} ) );
|
|
assert.eq( 1, t.count( {key:[2]} ) );
|
|
assert.eq( 1, t.count( {key:{$in:[[2]]}} ) );
|
|
}
|
|
|
|
doTest();
|
|
t.ensureIndex( {key:1} );
|
|
doTest();
|