switch from updateOne to findOneAndUpdate to return new document

master
rob 2 years ago
parent 7d2ee1f522
commit 0918b0822c

@ -178,7 +178,7 @@ class OAuth2Service extends SiteService {
* calling host.
*/
const client = await OAuth2Client.updateOne(
const client = await OAuth2Client.findOneAndUpdate(
{
'site.domain': clientDefinition.domain,
'site.domainKey': clientDefinition.domainKey,
@ -199,7 +199,10 @@ class OAuth2Service extends SiteService {
redirectUri: clientDefinition.coreAuth.redirectUri,
},
},
{ upsert: true, returnDocument: true },
{
upsert: true, // create if it doesn't exist
"new": true, // return the modified version
},
);
this.log.info('new OAuth2 client updated', {

Loading…
Cancel
Save