Status UpdateDriver::populateDocumentWithQueryFields(const BSONObj& query, mutablebson::Document& doc) const { CanonicalQuery* rawCG; // We canonicalize the query to collapse $and/$or, and the first arg (ns) is not needed Status s = CanonicalQuery::canonicalize("", query, &rawCG); if (!s.isOK()) return s; scoped_ptr<CanonicalQuery> cq(rawCG); return populateDocumentWithQueryFields(rawCG, doc); }
Status UpdateDriver::populateDocumentWithQueryFields(const BSONObj& query, mutablebson::Document& doc) const { CanonicalQuery* rawCG; // We canonicalize the query to collapse $and/$or, and the first arg (ns) is not needed // Also, because this is for the upsert case, where we insert a new document if one was // not found, the $where clause does not make sense, hence empty WhereCallback. Status s = CanonicalQuery::canonicalize("", query, &rawCG, WhereCallbackNoop()); if (!s.isOK()) return s; scoped_ptr<CanonicalQuery> cq(rawCG); return populateDocumentWithQueryFields(rawCG, doc); }