diff options
Diffstat (limited to 'src/mongo/db/op_observer/op_observer_impl.cpp')
-rw-r--r-- | src/mongo/db/op_observer/op_observer_impl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/op_observer/op_observer_impl.cpp b/src/mongo/db/op_observer/op_observer_impl.cpp index 721189c13d2..a3a892fa516 100644 --- a/src/mongo/db/op_observer/op_observer_impl.cpp +++ b/src/mongo/db/op_observer/op_observer_impl.cpp @@ -813,6 +813,14 @@ void OpObserverImpl::onUpdate(OperationContext* opCtx, const OplogUpdateEntryArg operation.setChangeStreamPreImageRecordingMode( ChangeStreamPreImageRecordingMode::kPreImagesCollection); } + + auto collectionDescription = + CollectionShardingState::get(opCtx, args.nss)->getCollectionDescription(opCtx); + if (collectionDescription.isSharded()) { + operation.setPostImageDocumentKey( + collectionDescription.extractDocumentKey(args.updateArgs->updatedDoc).getOwned()); + } + operation.setDestinedRecipient( shardingWriteRouter.getReshardingDestinedRecipient(args.updateArgs->updatedDoc)); operation.setFromMigrateIfTrue(args.updateArgs->source == OperationSource::kFromMigrate); |