diff options
author | Pawel Terlecki <pawel.terlecki@mongodb.com> | 2019-03-30 14:02:17 -0400 |
---|---|---|
committer | Pawel Terlecki <pawel.terlecki@mongodb.com> | 2019-04-05 18:05:37 -0400 |
commit | 0b4f23cf6567c05023e43d46729c6aa8712d7003 (patch) | |
tree | 5f6bf52727aa0590f1d082c72ee42cd6f689c16d /src/mongo/db/query | |
parent | 0158d96ae7e728a9732d24ccea4e929b779d082c (diff) | |
download | mongo-0b4f23cf6567c05023e43d46729c6aa8712d7003.tar.gz |
SERVER-40005 Added setters for query and update to FindAndModifyRequest
This is necessary for a corresponding change in enterprise modules.
Note that recreating a request member by member just for FLE would
lead to defects when somebody adds new members at some point.
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/find_and_modify_request.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/query/find_and_modify_request.h | 17 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/mongo/db/query/find_and_modify_request.cpp b/src/mongo/db/query/find_and_modify_request.cpp index bab9924e2a7..1ef84b03762 100644 --- a/src/mongo/db/query/find_and_modify_request.cpp +++ b/src/mongo/db/query/find_and_modify_request.cpp @@ -224,6 +224,13 @@ void FindAndModifyRequest::setArrayFilters(const std::vector<BSONObj>& arrayFilt } } +void FindAndModifyRequest::setQuery(BSONObj query) { + _query = query.getOwned(); +} +void FindAndModifyRequest::setUpdateObj(BSONObj updateObj) { + _updateObj = updateObj.getOwned(); +} + void FindAndModifyRequest::setShouldReturnNew(bool shouldReturnNew) { dassert(!_isRemove); _shouldReturnNew = shouldReturnNew; diff --git a/src/mongo/db/query/find_and_modify_request.h b/src/mongo/db/query/find_and_modify_request.h index 690d25bb61c..71e1ac983d1 100644 --- a/src/mongo/db/query/find_and_modify_request.h +++ b/src/mongo/db/query/find_and_modify_request.h @@ -110,12 +110,25 @@ public: // /** + * Sets the filter to find a document. + */ + void setQuery(BSONObj query); + + /** + * Sets the update object that specifies how a document gets updated. + */ + void setUpdateObj(BSONObj updateObj); + + /** * If shouldReturnNew is new, the findAndModify response should return the document * after the modification was applied if the query matched a document. Otherwise, * it will return the matched document before the modification. */ void setShouldReturnNew(bool shouldReturnNew); + /** + * Sets a flag whether the statement performs an upsert. + */ void setUpsert(bool upsert); // @@ -157,10 +170,10 @@ private: // Required fields const NamespaceString _ns; - const BSONObj _query; + BSONObj _query; // Required for updates - const BSONObj _updateObj; + BSONObj _updateObj; boost::optional<bool> _isUpsert; boost::optional<BSONObj> _fieldProjection; |