summaryrefslogtreecommitdiff
path: root/src/mongo/client/dbclient_base.cpp
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2021-12-22 23:45:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-14 22:40:54 +0000
commitda6685f2648051ce806ad700d31787a1f365cfdc (patch)
tree7e950c0b134ba10254d69b0b1ddb730ab927aecc /src/mongo/client/dbclient_base.cpp
parent2fb4480e741f46d89b1245295414ed36501c57ae (diff)
downloadmongo-da6685f2648051ce806ad700d31787a1f365cfdc.tar.gz
SERVER-62239 Put tenantId on opCtx if passed as $tenant
Diffstat (limited to 'src/mongo/client/dbclient_base.cpp')
-rw-r--r--src/mongo/client/dbclient_base.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index 98c49806f40..70c500fd412 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -186,8 +186,11 @@ void appendMetadata(OperationContext* opCtx,
}
request.body = bob.obj();
- if (auto securityToken = auth::getSecurityToken(opCtx)) {
- request.securityToken = securityToken->toBSON();
+
+ if (opCtx) {
+ if (auto securityToken = auth::getSecurityToken(opCtx)) {
+ request.securityToken = securityToken->toBSON();
+ }
}
}
} // namespace