mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-29 16:47:28 +01:00
empty field spec same as missing field spec for queries
This commit is contained in:
parent
b671ee788b
commit
495eaa8093
@ -162,6 +162,8 @@ namespace mongo {
|
||||
if ( d.moreJSObjs() ) {
|
||||
fields = auto_ptr< set<string> >(new set<string>());
|
||||
d.nextJsObj().getFieldNames(*fields);
|
||||
if ( fields->size() == 0 )
|
||||
fields.reset();
|
||||
}
|
||||
queryOptions = d.msg().data->dataAsInt();
|
||||
}
|
||||
|
@ -349,6 +349,20 @@ namespace QueryTests {
|
||||
ASSERT( !error() );
|
||||
}
|
||||
};
|
||||
|
||||
class EmptyFieldSpec : public ClientBase {
|
||||
public:
|
||||
~EmptyFieldSpec() {
|
||||
client().dropCollection( "querytests.EmptyFieldSpec" );
|
||||
}
|
||||
void run() {
|
||||
const char *ns = "querytests.EmptyFieldSpec";
|
||||
client().insert( ns, BSON( "a" << 1 ) );
|
||||
ASSERT( !client().findOne( ns, "" ).isEmpty() );
|
||||
BSONObj empty;
|
||||
ASSERT( !client().findOne( ns, "", &empty ).isEmpty() );
|
||||
}
|
||||
};
|
||||
|
||||
class All : public UnitTest::Suite {
|
||||
public:
|
||||
@ -368,6 +382,7 @@ namespace QueryTests {
|
||||
add< OplogReplayMode >();
|
||||
add< ArrayId >();
|
||||
add< UnderscoreNs >();
|
||||
add< EmptyFieldSpec >();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user