2009-04-06 20:11:32 +02:00
|
|
|
t = db.jstests_multi;
|
|
|
|
t.drop();
|
|
|
|
|
|
|
|
t.ensureIndex( { a: 1 } );
|
|
|
|
t.save( { a: [ 1, 2 ] } );
|
2009-07-16 18:06:36 +02:00
|
|
|
assert.eq( 1, t.find( { a: { $gt: 0 } } ).count() , "A" );
|
|
|
|
assert.eq( 1, t.find( { a: { $gt: 0 } } ).toArray().length , "B" );
|
2009-04-13 22:39:41 +02:00
|
|
|
|
|
|
|
t.drop();
|
|
|
|
t.save( { a: [ [ [ 1 ] ] ] } );
|
2009-07-16 18:06:36 +02:00
|
|
|
assert.eq( 0, t.find( { a:1 } ).count() , "C" );
|
|
|
|
assert.eq( 0, t.find( { a: [ 1 ] } ).count() , "D" );
|
|
|
|
assert.eq( 1, t.find( { a: [ [ 1 ] ] } ).count() , "E" );
|
|
|
|
assert.eq( 1, t.find( { a: [ [ [ 1 ] ] ] } ).count() , "F" );
|
2009-04-13 22:39:41 +02:00
|
|
|
|
|
|
|
t.drop();
|
|
|
|
t.save( { a: [ 1, 2 ] } );
|
2009-07-16 18:06:36 +02:00
|
|
|
assert.eq( 0, t.find( { a: { $ne: 1 } } ).count() , "G" );
|
2009-04-13 22:39:41 +02:00
|
|
|
|
|
|
|
t.drop();
|
|
|
|
t.save( { a: [ { b: 1 }, { b: 2 } ] } );
|
2009-07-16 18:06:36 +02:00
|
|
|
assert.eq( 0, t.find( { 'a.b': { $ne: 1 } } ).count() , "H" );
|
|
|
|
|
|
|
|
// TODO - run same tests with an index on a
|