本文整理汇总了C++中elementiterator::Context::outerArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::outerArray方法的具体用法?C++ Context::outerArray怎么用?C++ Context::outerArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elementiterator::Context
的用法示例。
在下文中一共展示了Context::outerArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matches
bool TypeMatchExpression::matches(const MatchableDocument* doc, MatchDetails* details) const {
MatchableDocument::IteratorHolder cursor(doc, &_elementPath);
while (cursor->more()) {
ElementIterator::Context e = cursor->next();
// In the case where _elementPath is referring to an array,
// $type should match elements of that array only.
// outerArray() helps to identify elements of the array
// and the containing array itself.
// This matters when we are looking for {$type: Array}.
// Example (_elementPath refers to field 'a' and _type is Array):
// a : [ // outer array. should not match
// 123, // inner array
// [ 456 ], // inner array. should match
// ...
// ]
if (_type == mongo::Array && e.outerArray()) {
continue;
}
if (!matchesSingleElement(e.element())) {
continue;
}
if (details && details->needRecord() && !e.arrayOffset().eoo()) {
details->setElemMatchKey(e.arrayOffset().fieldName());
}
return true;
}
return false;
}
示例2: matches
bool TypeMatchExpression::matches( const MatchableDocument* doc, MatchDetails* details ) const {
MatchableDocument::IteratorHolder cursor( doc, &_elementPath );
while ( cursor->more() ) {
ElementIterator::Context e = cursor->next();
if ( e.outerArray() )
continue;
if ( !matchesSingleElement( e.element() ) )
continue;
if ( details && details->needRecord() && !e.arrayOffset().eoo() ) {
details->setElemMatchKey( e.arrayOffset().fieldName() );
}
return true;
}
return false;
}