summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/filter.h
diff options
context:
space:
mode:
authorMartin Neupauer <martin.neupauer@mongodb.com>2019-08-29 13:22:09 +0000
committerevergreen <evergreen@mongodb.com>2019-08-29 13:22:09 +0000
commit3cdbdedce431fbc71a5eb89b689268e783d73bd4 (patch)
tree327109bb734c91384f13f5acee6b71c917ea1fd3 /src/mongo/db/exec/filter.h
parentffd486c3ff049abc9f8a2c76b3e2b9dea970c19b (diff)
downloadmongo-3cdbdedce431fbc71a5eb89b689268e783d73bd4.tar.gz
SERVER-42181 Make WorkingSetMember hold Document instead of BSONObj
SERVER-42157 Unowned mode for Document/Value
Diffstat (limited to 'src/mongo/db/exec/filter.h')
-rw-r--r--src/mongo/db/exec/filter.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/exec/filter.h b/src/mongo/db/exec/filter.h
index dcc079c9136..fff46d553dd 100644
--- a/src/mongo/db/exec/filter.h
+++ b/src/mongo/db/exec/filter.h
@@ -42,20 +42,20 @@ namespace mongo {
*/
class WorkingSetMatchableDocument : public MatchableDocument {
public:
- WorkingSetMatchableDocument(WorkingSetMember* wsm) : _wsm(wsm) {}
+ WorkingSetMatchableDocument(WorkingSetMember* wsm)
+ : _wsm(wsm), _obj(_wsm->doc.value().toBson()) {}
// This is only called by a $where query. The query system must be smart enough to realize
// that it should do a fetch beforehand.
BSONObj toBSON() const {
- invariant(_wsm->hasObj());
- return _wsm->obj.value();
+ return _obj;
}
ElementIterator* allocateIterator(const ElementPath* path) const final {
// BSONElementIterator does some interesting things with arrays that I don't think
// SimpleArrayElementIterator does.
if (_wsm->hasObj()) {
- return new BSONElementIterator(path, _wsm->obj.value());
+ return new BSONElementIterator(path, _obj);
}
// NOTE: This (kind of) duplicates code in WorkingSetMember::getFieldDotted.
@@ -95,6 +95,7 @@ public:
private:
WorkingSetMember* _wsm;
+ BSONObj _obj;
};
class IndexKeyMatchableDocument : public MatchableDocument {