summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/working_set.cpp
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2016-06-03 13:26:35 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2016-06-03 13:26:35 -0400
commitcecbe424d32cbb475d9b0384d29b98a9fba9c89f (patch)
tree0ce2632b078fee8865f15a56cf07c684a8260c21 /src/mongo/db/exec/working_set.cpp
parent8900002b731358b0beedadb2ceb4e3156de402b6 (diff)
downloadmongo-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/exec/working_set.cpp')
-rw-r--r--src/mongo/db/exec/working_set.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/exec/working_set.cpp b/src/mongo/db/exec/working_set.cpp
index 96b5c0ca360..6e8efc34e59 100644
--- a/src/mongo/db/exec/working_set.cpp
+++ b/src/mongo/db/exec/working_set.cpp
@@ -28,6 +28,7 @@
#include "mongo/db/exec/working_set.h"
+#include "mongo/db/bson/dotted_path_support.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/record_fetcher.h"
@@ -36,6 +37,8 @@ namespace mongo {
using std::string;
+namespace dps = ::mongo::dotted_path_support;
+
WorkingSet::MemberHolder::MemberHolder() : member(NULL) {}
WorkingSet::MemberHolder::~MemberHolder() {}
@@ -205,7 +208,7 @@ bool WorkingSetMember::hasFetcher() const {
bool WorkingSetMember::getFieldDotted(const string& field, BSONElement* out) const {
// If our state is such that we have an object, use it.
if (hasObj()) {
- *out = obj.value().getFieldDotted(field);
+ *out = dps::extractElementAtPath(obj.value(), field);
return true;
}