mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
24 lines
508 B
JavaScript
24 lines
508 B
JavaScript
t = db.jstests_or4;
|
|
t.drop();
|
|
|
|
t.ensureIndex( {a:1} );
|
|
t.ensureIndex( {b:1} );
|
|
|
|
t.save( {a:2} );
|
|
t.save( {b:3} );
|
|
t.save( {a:2,b:3} );
|
|
|
|
assert.eq( 3, t.count( {$or:[{a:2},{b:3}]} ) );
|
|
assert.eq( 2, t.count( {$or:[{a:2},{a:2}]} ) );
|
|
|
|
t.remove( {$or:[{a:2},{b:3}]} );
|
|
assert.eq( 0, t.count() );
|
|
|
|
t.save( {a:2} );
|
|
t.save( {b:3} );
|
|
t.save( {a:2,b:3} );
|
|
|
|
t.update( {$or:[{a:2},{b:3}]}, {$set:{z:1}}, false, true );
|
|
assert.eq( 3, t.count( {z:1} ) );
|
|
|
|
assert.eq( 3, t.find( {$or:[{a:2},{b:3}]} ).toArray().length ); |