コード例 #1
0
ファイル: modifier_pull.cpp プロジェクト: DINKIN/mongo
bool ModifierPull::isMatch(mutablebson::ConstElement element) {
    // TODO: We are assuming that 'element' hasValue is true. That might be OK if the
    // conflict detection logic will prevent us from ever seeing a deserialized element,
    // but are we sure about that?

    dassert(element.hasValue());

    if (!_matchExpr)
        return (element.compareWithBSONElement(_exprElt, _collator, false) == 0);

    if (_matcherOnPrimitive) {
        // TODO: This is kinda slow.
        BSONObj candidate = element.getValue().wrap("");
        return _matchExpr->matchesBSON(candidate);
    }

    if (element.getType() != Object)
        return false;

    return _matchExpr->matchesBSON(element.getValueObject());
}
コード例 #2
0
 bool match(const mutablebson::ConstElement& element) final {
     BSONObj candidate = element.getValue().wrap("");
     return _matchExpr->matchesBSON(candidate);
 }