void OrMatchExpression::serialize(BSONObjBuilder* out) const { if (!numChildren()) { out->append(AlwaysFalseMatchExpression::kName, 1); return; } BSONArrayBuilder arrBob(out->subarrayStart("$or")); _listToBSON(&arrBob); }
void AndMatchExpression::serialize(BSONObjBuilder* out) const { if (!numChildren()) { // It is possible for an AndMatchExpression to have no children, resulting in the serialized // expression {$and: []}, which is not a valid query object. return; } BSONArrayBuilder arrBob(out->subarrayStart("$and")); _listToBSON(&arrBob); arrBob.doneFast(); }
void OrMatchExpression::serialize(BSONObjBuilder* out) const { if (!numChildren()) { // It is possible for an OrMatchExpression to have no children, resulting in the serialized // expression {$or: []}, which is not a valid query object. An empty $or is logically // equivalent to {$alwaysFalse: 1}. out->append(AlwaysFalseMatchExpression::kName, 1); return; } BSONArrayBuilder arrBob(out->subarrayStart("$or")); _listToBSON(&arrBob); }
void NorMatchExpression::serialize(BSONObjBuilder* out) const { BSONArrayBuilder arrBob(out->subarrayStart("$nor")); _listToBSON(&arrBob); }
void OrMatchExpression::toBSON(BSONObjBuilder* out) const { BSONArrayBuilder arrBob(out->subarrayStart("$or")); _listToBSON(&arrBob); }