diff options
Diffstat (limited to 'src/mongo/db/ops/insert.cpp')
| -rw-r--r-- | src/mongo/db/ops/insert.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/ops/insert.cpp b/src/mongo/db/ops/insert.cpp index 61d92fda6bf..8c949b333c7 100644 --- a/src/mongo/db/ops/insert.cpp +++ b/src/mongo/db/ops/insert.cpp @@ -87,6 +87,7 @@ Status validateDepth(const BSONObj& obj) { StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx, const BSONObj& doc, + bool bypassEmptyTsReplacement, bool* containsDotsAndDollarsField) { bool validationDisabled = DocumentValidationSettings::get(opCtx).isInternalValidationDisabled(); @@ -139,7 +140,8 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx, } if (!validationDisabled) { - if (e.type() == bsonTimestamp && e.timestampValue() == 0) { + if (!bypassEmptyTsReplacement && e.type() == bsonTimestamp && + e.timestampValue() == 0) { // we replace Timestamp(0,0) at the top level with a correct value // in the fast pass, we just mark that we want to swap hasTimestampToFix = true; @@ -187,7 +189,8 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx, BSONElement e = i.next(); if (hadId && e.fieldNameStringData() == "_id") { // no-op - } else if (e.type() == bsonTimestamp && e.timestampValue() == 0) { + } else if (!bypassEmptyTsReplacement && e.type() == bsonTimestamp && + e.timestampValue() == 0) { auto nextTime = VectorClockMutable::get(opCtx)->tickClusterTime(1); b.append(e.fieldName(), nextTime.asTimestamp()); } else { |
