diff options
author | Aaron <aaron@10gen.com> | 2010-02-22 16:24:17 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2010-02-22 16:24:17 -0800 |
commit | fe607048a1559d057171b5eb8e7665658191dfff (patch) | |
tree | 25dec304502aec01a095a855a665d8a02b96219c /jstests/not2.js | |
parent | 0ce8996a44e19c0380e66335e6b6c32a229f3bba (diff) | |
download | mongo-fe607048a1559d057171b5eb8e7665658191dfff.tar.gz |
SERVER-251 /regex checkpoint
Diffstat (limited to 'jstests/not2.js')
-rw-r--r-- | jstests/not2.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/jstests/not2.js b/jstests/not2.js index d8500097d2f..670cdf020e7 100644 --- a/jstests/not2.js +++ b/jstests/not2.js @@ -11,10 +11,15 @@ check = function( query, expected, size ) { } } +fail = function( query ) { + t.count( query ); + assert( db.getLastError(), tojson( query ) ); +} + t.save( {i:"a"} ); t.save( {i:"b"} ); -//check( {i:{$not:"a"}}, "b" ); +fail( {i:{$not:"a"}} ); check( {i:{$not:{$gt:"a"}}}, "a" ); check( {i:{$not:{$gte:"b"}}}, "a" ); check( {i:{$exists:true}}, "a", 2 ); @@ -28,9 +33,17 @@ check( {i:{$not:{$nin:["a"]}}}, "a" ); // $mod // $size check( {i:{$not:/a/}}, "b" ); -check( {i:{$not:/a/,$regex:"b"}}, "b" ); +check( {i:{$not:/(a|b)/}}, "", 0 ); +check( {i:{$not:/a/,$regex:"a"}}, "", 0 ); check( {i:{$not:/aa/}}, "a", 2 ); -// other type of regex +fail( {i:{$not:{$regex:"a"}}} ); +fail( {i:{$not:{$options:"a"}}} ); + +t.drop(); +t.save( {i:1} ); +check( {i:{$not:{$mod:[5,1]}}}, null, 0 ); +check( {i:{$mod:[5,2]}}, null, 0 ); +check( {i:{$not:{$mod:[5,2]}}}, 1, 1 ); //in array //$all |