diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-06-03 13:26:35 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-06-03 13:26:35 -0400 |
commit | cecbe424d32cbb475d9b0384d29b98a9fba9c89f (patch) | |
tree | 0ce2632b078fee8865f15a56cf07c684a8260c21 /src/mongo/db/fts/fts_spec.cpp | |
parent | 8900002b731358b0beedadb2ceb4e3156de402b6 (diff) | |
download | mongo-cecbe424d32cbb475d9b0384d29b98a9fba9c89f.tar.gz |
SERVER-23114 Move functions involving dotted paths to separate library.
The ability to specify a dotted path (e.g. "a.b") to traverse through
embedded objects and array elements isn't defined in the BSON
specification and so it doesn't belong in our BSON library.
The following functions have been defined within a 'dotted_path_support'
namespace and accept an additional BSONObj as their first argument to
replace the associated method on the BSONObj class.
- extractElementAtPath() is functionally equivalent to
BSONObj::getFieldDotted().
- extractElementAtPathOrArrayAlongPath() is functionally equivalent to
BSONObj::getFieldDottedOrArray().
- extractAllElementsAlongPath() is functionally equivalent to
BSONObj::getFieldsDotted().
- extractElementsBasedOnTemplate() is functionally equivalent to
BSONObj::extractFields().
- compareObjectsAccordingToSort() is functionally equivalent to
BSONObj::woSortOrder().
Diffstat (limited to 'src/mongo/db/fts/fts_spec.cpp')
-rw-r--r-- | src/mongo/db/fts/fts_spec.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/db/fts/fts_spec.cpp b/src/mongo/db/fts/fts_spec.cpp index 0c03ed8aa18..c9216b0bb45 100644 --- a/src/mongo/db/fts/fts_spec.cpp +++ b/src/mongo/db/fts/fts_spec.cpp @@ -31,6 +31,7 @@ #include "mongo/db/fts/fts_spec.h" +#include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/field_ref.h" #include "mongo/db/fts/fts_element_iterator.h" #include "mongo/db/fts/fts_tokenizer.h" @@ -45,6 +46,7 @@ namespace fts { using std::map; using std::string; using namespace mongoutils; +namespace dps = ::mongo::dotted_path_support; const double DEFAULT_WEIGHT = 1; const double MAX_WEIGHT = 1000000000; @@ -242,7 +244,7 @@ Status FTSSpec::getIndexPrefix(const BSONObj& query, BSONObj* out) const { BSONObjBuilder b; for (unsigned i = 0; i < numExtraBefore(); i++) { - BSONElement e = query.getFieldDotted(extraBefore(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)); |