Status FTSSpec::getIndexPrefix( const BSONObj& query, BSONObj* out ) const { if ( numExtraBefore() == 0 ) { *out = BSONObj(); return Status::OK(); } BSONObjBuilder b; for ( unsigned i = 0; i < numExtraBefore(); i++ ) { BSONElement e = query.getFieldDotted(extraBefore(i)); if ( e.eoo() ) return Status( ErrorCodes::BadValue, str::stream() << "need have an equality filter on: " << extraBefore(i) ); if ( e.isABSONObj() && e.Obj().firstElement().getGtLtOp( -1 ) != -1 ) return Status( ErrorCodes::BadValue, str::stream() << "need have an equality filter on: " << extraBefore(i) ); b.append( e ); } *out = b.obj(); return Status::OK(); }
Status FTSSpec::getIndexPrefix(const BSONObj& query, BSONObj* out) const { if (numExtraBefore() == 0) { *out = BSONObj(); return Status::OK(); } BSONObjBuilder b; for (unsigned i = 0; i < numExtraBefore(); i++) { BSONElement e = dps::extractElementAtPath(query, extraBefore(i)); if (e.eoo()) return Status(ErrorCodes::BadValue, str::stream() << "need have an equality filter on: " << extraBefore(i)); if (e.isABSONObj() && MatchExpressionParser::parsePathAcceptingKeyword(e.Obj().firstElement())) return Status(ErrorCodes::BadValue, str::stream() << "need have an equality filter on: " << extraBefore(i)); b.append(e); } *out = b.obj(); return Status::OK(); }