diff options
author | jannaerin <golden.janna@gmail.com> | 2021-12-22 23:45:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-14 22:40:54 +0000 |
commit | da6685f2648051ce806ad700d31787a1f365cfdc (patch) | |
tree | 7e950c0b134ba10254d69b0b1ddb730ab927aecc /src/mongo/client | |
parent | 2fb4480e741f46d89b1245295414ed36501c57ae (diff) | |
download | mongo-da6685f2648051ce806ad700d31787a1f365cfdc.tar.gz |
SERVER-62239 Put tenantId on opCtx if passed as $tenant
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/dbclient_base.cpp | 7 |
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 |