summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/coll_mod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/coll_mod.cpp')
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index 49a666c9c67..5ad39981d44 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -74,6 +74,7 @@ struct CollModRequest {
BSONElement collValidator = {};
std::string collValidationAction = {};
std::string collValidationLevel = {};
+ bool recordPreImages = false;
};
StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx,
@@ -222,6 +223,13 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx,
return Status(ErrorCodes::InvalidOptions, "'viewOn' option must be a string");
}
cmr.viewOn = e.str();
+ } else if (fieldName == "recordPreImages") {
+ if (isView) {
+ return {ErrorCodes::InvalidOptions,
+ str::stream() << "option not supported on a view: " << fieldName};
+ }
+
+ cmr.recordPreImages = e.trueValue();
} else {
if (isView) {
return Status(ErrorCodes::InvalidOptions,
@@ -396,6 +404,10 @@ Status _collModInternal(OperationContext* opCtx,
if (!cmrNew.collValidationLevel.empty())
invariant(coll->setValidationLevel(opCtx, cmrNew.collValidationLevel));
+ if (cmrNew.recordPreImages != oldCollOptions.recordPreImages) {
+ coll->setRecordPreImages(opCtx, cmrNew.recordPreImages);
+ }
+
// Only observe non-view collMods, as view operations are observed as operations on the
// system.views collection.
getGlobalServiceContext()->getOpObserver()->onCollMod(