0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

array elt may not contain referenced subobject

This commit is contained in:
Aaron 2009-04-06 13:41:47 -04:00
parent e09106351e
commit 0b73b8d325
2 changed files with 18 additions and 1 deletions

View File

@ -644,7 +644,9 @@ assert( !eloc.isNull() );
if ( e.eoo() )
break;
if ( strlen( nameWithinArray ) != 0 ) {
if ( nameWithinArray[ 0 ] != '\0' ) {
if ( e.type() != Object )
continue;
e = e.embeddedObject().getFieldDotted( nameWithinArray );
if ( e.eoo() )
continue;

View File

@ -381,6 +381,20 @@ namespace NamespaceTests {
}
};
class SubobjectMissing : public Base {
public:
void run() {
create();
BSONObjSetDefaultOrder keys;
id().getKeysFromObject( fromjson( "{a:[1,2]}" ), keys );
checkSize( 0, keys );
}
private:
virtual BSONObj key() const {
return aDotB();
}
};
// TODO
// array subelement complex
// parallel arrays complex
@ -584,6 +598,7 @@ namespace NamespaceTests {
add< IndexDetailsTests::ArraySubobjectSingleMissing >();
add< IndexDetailsTests::ArraySubobjectMissing >();
add< IndexDetailsTests::MissingField >();
add< IndexDetailsTests::SubobjectMissing >();
add< NamespaceDetailsTests::Create >();
add< NamespaceDetailsTests::SingleAlloc >();
add< NamespaceDetailsTests::Realloc >();