Status ComparisonMatchExpression::init(StringData path, BSONElement rhs) {
    _rhs = rhs;

    invariant(_rhs);

    if (_rhs.type() == BSONType::Undefined) {
        return Status(ErrorCodes::BadValue, "cannot compare to undefined");
    }

    switch (matchType()) {
        case LT:
        case LTE:
        case EQ:
        case GT:
        case GTE:
            break;
        default:
            return Status(ErrorCodes::BadValue, "bad match type for ComparisonMatchExpression");
    }

    return setPath(path);
}
Status ComparisonMatchExpression::init(StringData path, BSONElement rhs) {
    _rhs = rhs;

    invariant(_rhs);

    if (_rhs.type() == BSONType::Undefined) {
        return Status(ErrorCodes::BadValue, "cannot compare to undefined");
    }

    switch (matchType()) {
        case LT:
        case LTE:
        case EQ:
        case GT:
        case GTE:
            break;
        default:
            return Status(ErrorCodes::BadValue, "bad match type for ComparisonMatchExpression");
    }

    return setPath(path);
}