Files
mongo/jstests/core/null.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

27 lines
616 B
JavaScript

t = db.null1;
t.drop();
t.save( { x : 1 } );
t.save( { x : null } );
assert.eq( 1 , t.find( { x : null } ).count() , "A" );
assert.eq( 1 , t.find( { x : { $ne : null } } ).count() , "B" );
t.ensureIndex( { x : 1 } );
assert.eq( 1 , t.find( { x : null } ).count() , "C" );
assert.eq( 1 , t.find( { x : { $ne : null } } ).count() , "D" );
// -----
assert.eq( 2, t.find( { y : null } ).count(), "E" );
t.ensureIndex( { y : 1 } );
assert.eq( 2, t.find( { y : null } ).count(), "E" );
t.dropIndex( { y : 1 } );
t.ensureIndex( { y : 1 }, { sparse : true } );
assert.eq( 2, t.find( { y : null } ).count(), "E" );