Merge pull request #26050 from overleaf/em-saml-user-query

Improve index usage for SAML user query

GitOrigin-RevId: 189aba60a12c8369a0062e7df4c57bef8a16c98c
This commit is contained in:
Brian Gough
2025-06-03 08:06:47 +00:00
committed by Copybot
parent 4b9963757f
commit 3a96df4623
@@ -210,9 +210,13 @@ async function getUser(providerId, externalUserId, userIdAttribute) {
)
}
const user = await User.findOne({
'samlIdentifiers.externalUserId': externalUserId.toString(),
'samlIdentifiers.providerId': providerId.toString(),
'samlIdentifiers.userIdAttribute': userIdAttribute.toString(),
samlIdentifiers: {
$elemMatch: {
externalUserId: externalUserId.toString(),
providerId: providerId.toString(),
userIdAttribute: userIdAttribute.toString(),
},
},
}).exec()
return user