summaryrefslogtreecommitdiff
path: root/jstests/not2.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2010-02-22 16:24:17 -0800
committerAaron <aaron@10gen.com>2010-02-22 16:24:17 -0800
commitfe607048a1559d057171b5eb8e7665658191dfff (patch)
tree25dec304502aec01a095a855a665d8a02b96219c /jstests/not2.js
parent0ce8996a44e19c0380e66335e6b6c32a229f3bba (diff)
downloadmongo-fe607048a1559d057171b5eb8e7665658191dfff.tar.gz
SERVER-251 /regex checkpoint
Diffstat (limited to 'jstests/not2.js')
-rw-r--r--jstests/not2.js19
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