0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

test for SERVER-187 - $all with embedded objects

This commit is contained in:
Eliot Horowitz 2009-07-27 11:47:28 -04:00
parent 1920aea8d3
commit fbe8c8373f

23
jstests/all2.js Normal file
View File

@ -0,0 +1,23 @@
t = db.all2;
t.drop();
t.save( { a : [ { x : 1 } , { x : 2 } ] } )
t.save( { a : [ { x : 2 } , { x : 3 } ] } )
t.save( { a : [ { x : 3 } , { x : 4 } ] } )
function check( n , q , e ){
assert.eq( n , t.find( q ).count() , tojson( q ) + " " + e );
}
check( 1 , { "a.x" : { $in : [ 1 ] } } , "A" );
check( 2 , { "a.x" : { $in : [ 2 ] } } , "B" );
check( 2 , { "a.x" : { $in : [ 1 , 2 ] } } , "C" );
check( 3 , { "a.x" : { $in : [ 2 , 3 ] } } , "D" );
check( 3 , { "a.x" : { $in : [ 1 , 3 ] } } , "E" );
// TODO SERVER-187
//check( 1 , { "a.x" : { all : [ 1 , 2 ] } } , "F" );
//check( 1 , { "a.x" : { all : [ 2 , 3 ] } } , "G" );
//check( 0 , { "a.x" : { all : [ 1 , 3 ] } } , "H" );