summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/dbcommands.cpp')
-rw-r--r--src/mongo/db/commands/dbcommands.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 147df508a9c..ba74cea6106 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -220,7 +220,9 @@ public:
!storageEngine->supportsRecoveryTimestamp());
}
- Reply reply;
+ // We need to copy the serialization context from the request to the reply object
+ Reply reply(
+ SerializationContext::stateCommandReply(request().getSerializationContext()));
uassertStatusOK(
dropCollection(opCtx,
request().getNamespace(),
@@ -457,7 +459,13 @@ public:
uassert(ErrorCodes::OperationFailed, "No collection name specified", !nss.coll().empty());
- result.append("ns", NamespaceStringUtil::serialize(nss));
+ // We need to use the serialization context from the request when calling
+ // NamespaceStringUtil to build the reply
+ result.append(
+ "ns",
+ NamespaceStringUtil::serialize(
+ nss, SerializationContext::stateCommandReply(cmd.getSerializationContext())));
+
auto spec = StorageStatsSpec::parse(IDLParserContext("collStats"), cmdObj);
Status status = appendCollectionStorageStats(opCtx, nss, spec, &result);
if (!status.isOK() && (status.code() != ErrorCodes::NamespaceNotFound)) {
@@ -640,7 +648,8 @@ public:
AutoGetDb autoDb(opCtx, dbname, MODE_IS);
Database* db = autoDb.getDb();
- Reply reply;
+ // We need to copy the serialization context from the request to the reply object
+ Reply reply(SerializationContext::stateCommandReply(cmd.getSerializationContext()));
reply.setDB(dbname.db());
if (!db) {