diff options
Diffstat (limited to 'jstests/type2.js')
-rw-r--r-- | jstests/type2.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/type2.js b/jstests/type2.js new file mode 100644 index 0000000..820607e --- /dev/null +++ b/jstests/type2.js @@ -0,0 +1,19 @@ +// SERVER-1735 $type:10 matches null value, not missing value. + +t = db.jstests_type2; +t.drop(); + +t.save( {a:null} ); +t.save( {} ); +t.save( {a:'a'} ); + +function test() { + assert.eq( 2, t.count( {a:null} ) ); + assert.eq( 1, t.count( {a:{$type:10}} ) ); + assert.eq( 2, t.count( {a:{$exists:true}} ) ); + assert.eq( 1, t.count( {a:{$exists:false}} ) ); +} + +test(); +t.ensureIndex( {a:1} ); +test();
\ No newline at end of file |