0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00
This commit is contained in:
Aaron 2010-03-08 18:16:53 -08:00
parent 916468b7e7
commit 6c7dc2b0f8
2 changed files with 24 additions and 9 deletions

View File

@ -565,6 +565,17 @@ namespace mongo {
if ( ret != 1 )
return ret;
}
if ( em.myregex.get() ) {
BSONElementSet s;
obj.getFieldsDotted( fieldName, s );
for( vector<RegexMatcher>::const_iterator i = em.myregex->begin(); i != em.myregex->end(); ++i ) {
for( BSONElementSet::const_iterator j = s.begin(); j != s.end(); ++j ) {
if ( regexMatches( *i, *j ) ) {
return -1;
}
}
}
}
return 1;
}

View File

@ -10,15 +10,19 @@ x = /.*y.*/
doit = function() {
assert.eq( 1 , t.find( { x : a } ).count() , "A" )
assert.eq( 2 , t.find( { x : x } ).count() , "B" )
assert.eq( 2 , t.find( { x : { $in: [ x ] } } ).count() , "C" ) // SERVER-322
assert.eq( 1 , t.find( { x : { $in: [ a, "xyz1" ] } } ).count() , "D" ) // SERVER-322
assert.eq( 2 , t.find( { x : { $in: [ a, "xyz2" ] } } ).count() , "E" ) // SERVER-322
assert.eq( 1 , t.find( { x : { $all : [ a , x ] } } ).count() , "F" ) // SERVER-505
assert.eq( 1 , t.find( { x : { $all : [ a , "abc" ] } } ).count() , "G" ) // SERVER-505
assert.eq( 0 , t.find( { x : { $all : [ a , "ac" ] } } ).count() , "H" ) // SERVER-505
assert.eq( 1 , t.find( { x : a } ).count() , "A" );
assert.eq( 2 , t.find( { x : x } ).count() , "B" );
assert.eq( 2 , t.find( { x : { $in: [ x ] } } ).count() , "C" ); // SERVER-322
assert.eq( 1 , t.find( { x : { $in: [ a, "xyz1" ] } } ).count() , "D" ); // SERVER-322
assert.eq( 2 , t.find( { x : { $in: [ a, "xyz2" ] } } ).count() , "E" ); // SERVER-322
assert.eq( 1 , t.find( { x : { $all : [ a , x ] } } ).count() , "F" ); // SERVER-505
assert.eq( 1 , t.find( { x : { $all : [ a , "abc" ] } } ).count() , "G" ); // SERVER-505
assert.eq( 0 , t.find( { x : { $all : [ a , "ac" ] } } ).count() , "H" ); // SERVER-505
assert.eq( 0 , t.find( { x : { $nin: [ x ] } } ).count() , "I" ); // SERVER-322
assert.eq( 1 , t.find( { x : { $nin: [ a, "xyz1" ] } } ).count() , "J" ); // SERVER-322
assert.eq( 0 , t.find( { x : { $nin: [ a, "xyz2" ] } } ).count() , "K" ); // SERVER-322
assert.eq( 2 , t.find( { x : { $not: { $nin: [ x ] } } } ).count() , "L" ); // SERVER-322
assert.eq( 1 , t.find( { x : { $nin: [ /^a.c/ ] } } ).count() , "M" ) // SERVER-322
}
doit();