diff options
Diffstat (limited to 'jstests/core/null.js')
-rw-r--r-- | jstests/core/null.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/jstests/core/null.js b/jstests/core/null.js new file mode 100644 index 00000000000..f4bdeb44a4d --- /dev/null +++ b/jstests/core/null.js @@ -0,0 +1,26 @@ + +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" ); |