diff options
Diffstat (limited to 'src/mongo/s/write_ops/batched_command_request.cpp')
-rw-r--r-- | src/mongo/s/write_ops/batched_command_request.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/s/write_ops/batched_command_request.cpp b/src/mongo/s/write_ops/batched_command_request.cpp index 2f7c9fcd269..087018b7829 100644 --- a/src/mongo/s/write_ops/batched_command_request.cpp +++ b/src/mongo/s/write_ops/batched_command_request.cpp @@ -36,6 +36,7 @@ namespace mongo { namespace { const auto kWriteConcern = "writeConcern"_sd; +const auto kAllowImplicitCollectionCreation = "allowImplicitCollectionCreation"_sd; template <class T> BatchedCommandRequest constructBatchedCommandRequest(const OpMsgRequest& request) { @@ -51,6 +52,10 @@ BatchedCommandRequest constructBatchedCommandRequest(const OpMsgRequest& request batchRequest.setWriteConcern(writeConcernField.Obj()); } + if (auto allowImplicitElement = request.body[kAllowImplicitCollectionCreation]) { + batchRequest.setAllowImplicitCreate(allowImplicitElement.boolean()); + } + return batchRequest; } @@ -161,6 +166,8 @@ void BatchedCommandRequest::serialize(BSONObjBuilder* builder) const { if (_writeConcern) { builder->append(kWriteConcern, *_writeConcern); } + + builder->append(kAllowImplicitCollectionCreation, _allowImplicitCollectionCreation); } BSONObj BatchedCommandRequest::toBSON() const { |