summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/aggregation_request.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/aggregation_request.cpp')
-rw-r--r--src/mongo/db/pipeline/aggregation_request.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/aggregation_request.cpp b/src/mongo/db/pipeline/aggregation_request.cpp
index a948696b526..8e8761547aa 100644
--- a/src/mongo/db/pipeline/aggregation_request.cpp
+++ b/src/mongo/db/pipeline/aggregation_request.cpp
@@ -180,6 +180,21 @@ StatusWith<AggregationRequest> AggregationRequest::parseFromBSON(
}
} else if (bypassDocumentValidationCommandOption() == fieldName) {
request.setBypassDocumentValidation(elem.trueValue());
+ } else if (kRequestResumeToken == fieldName) {
+ if (elem.type() != BSONType::Bool) {
+ return {ErrorCodes::TypeMismatch,
+ str::stream()
+ << fieldName << "must be a boolean, not a " << typeName(elem.type())};
+ }
+
+ request.setRequestResumeToken(elem.Bool());
+
+ if (request.getRequestResumeToken() && !request.getNamespaceString().isOplog()) {
+ return {ErrorCodes::FailedToParse,
+ str::stream()
+ << fieldName << " must only be set for the oplog namespace, not "
+ << request.getNamespaceString()};
+ }
} else if (WriteConcernOptions::kWriteConcernField == fieldName) {
if (elem.type() != BSONType::Object) {
return {ErrorCodes::TypeMismatch,
@@ -315,6 +330,7 @@ Document AggregationRequest::serializeToCommandObj() const {
{kNeedsMergeName, _needsMerge ? Value(true) : Value()},
{bypassDocumentValidationCommandOption(),
_bypassDocumentValidation ? Value(true) : Value()},
+ {kRequestResumeToken, _requestResumeToken ? Value(true) : Value()},
// Only serialize a collation if one was specified.
{kCollationName, _collation.isEmpty() ? Value() : Value(_collation)},
// Only serialize batchSize if not an explain, otherwise serialize an empty cursor object.