Skip to content

Commit bab879f

Browse files
committed
$isolated synonym for $atomic
1 parent 5f94b6b commit bab879f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

db/matcher.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,14 @@ namespace mongo {
371371
return;
372372
}
373373

374-
if ( strcmp(e.fieldName(), "$where")==0 ) {
374+
const char *fn = e.fieldName();
375+
if ( str::equals(fn, "$where") ) {
375376
parseWhere(e);
376377
return;
377378
}
378379

379380
if ( e.type() == RegEx ) {
380-
addRegex( e.fieldName(), e.regex(), e.regexFlags() );
381+
addRegex( fn, e.regex(), e.regexFlags() );
381382
return;
382383
}
383384

@@ -440,10 +441,12 @@ namespace mongo {
440441
if ( e.type() == Array ) {
441442
_hasArray = true;
442443
}
443-
else if( strcmp(e.fieldName(), "$atomic") == 0 ) {
444-
uassert( 14844, "$atomic specifier must be a top level field", !nested );
445-
_atomic = e.trueValue();
446-
return;
444+
else if( *fn == '$' ) {
445+
if( str::equals(fn, "$atomic") || str::equals(fn, "$isolated") ) {
446+
uassert( 14844, "$atomic specifier must be a top level field", !nested );
447+
_atomic = e.trueValue();
448+
return;
449+
}
447450
}
448451

449452
// normal, simple case e.g. { a : "foo" }

0 commit comments

Comments
 (0)