diff options
author | Martin Neupauer <martin.neupauer@mongodb.com> | 2019-02-26 16:11:27 -0500 |
---|---|---|
committer | Martin Neupauer <martin.neupauer@mongodb.com> | 2019-03-26 10:26:11 -0400 |
commit | b3c4979387d711a46dc5837ac861b9c2e34eb631 (patch) | |
tree | e83b2fdd3176c1bbacb707d404394a66ecba5a42 /src/mongo/db/pipeline/aggregation_request.cpp | |
parent | 1053cf8347e7aeaca24d47039980c765dae75d5b (diff) | |
download | mongo-b3c4979387d711a46dc5837ac861b9c2e34eb631.tar.gz |
SERVER-40209 Implement $$NOW and $$CLUSTER_TIME
Diffstat (limited to 'src/mongo/db/pipeline/aggregation_request.cpp')
-rw-r--r-- | src/mongo/db/pipeline/aggregation_request.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/aggregation_request.cpp b/src/mongo/db/pipeline/aggregation_request.cpp index ce2dc95da88..2357693d4f0 100644 --- a/src/mongo/db/pipeline/aggregation_request.cpp +++ b/src/mongo/db/pipeline/aggregation_request.cpp @@ -239,6 +239,13 @@ StatusWith<AggregationRequest> AggregationRequest::parseFromBSON( WriteConcernOptions writeConcern; uassertStatusOK(writeConcern.parse(elem.embeddedObject())); request.setWriteConcern(writeConcern); + } else if (kRuntimeConstants == fieldName) { + try { + IDLParserErrorContext ctx("internalRuntimeConstants"); + request.setRuntimeConstants(RuntimeConstants::parse(ctx, elem.Obj())); + } catch (const DBException& ex) { + return ex.toStatus(); + } } else if (!isGenericArgument(fieldName)) { return {ErrorCodes::FailedToParse, str::stream() << "unrecognized field '" << elem.fieldName() << "'"}; @@ -342,6 +349,8 @@ Document AggregationRequest::serializeToCommandObj() const { {kExchangeName, _exchangeSpec ? Value(_exchangeSpec->toBSON()) : Value()}, {WriteConcernOptions::kWriteConcernField, _writeConcern ? Value(_writeConcern->toBSON()) : Value()}, + // Only serialize runtime constants if any were specified. + {kRuntimeConstants, _runtimeConstants ? Value(_runtimeConstants->toBSON()) : Value()}, }; } } // namespace mongo |