Skip to content

Commit b4e36c8

Browse files
committed
Update mongoose usage to no longer use n
1 parent e3993da commit b4e36c8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/controller/org.controller/org.controller.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ async function updateOrg (req, res, next) {
332332
let agt = setAggregateOrgObj({ short_name: shortName })
333333

334334
// org doesn't exist
335-
if (!org) {
336-
logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
337-
return res.status(404).json(error.orgDnePathParam(shortName))
338-
}
335+
// if (!org) {
336+
// logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
337+
// return res.status(404).json(error.orgDnePathParam(shortName))
338+
// }
339339

340340
Object.keys(req.ctx.query).forEach(k => {
341341
const key = k.toLowerCase()
@@ -395,7 +395,7 @@ async function updateOrg (req, res, next) {
395395

396396
// update org
397397
let result = await orgRepo.updateByOrgUUID(org.UUID, newOrg)
398-
if (result.n === 0) {
398+
if (result.matchedCount === 0) {
399399
logger.info({ uuid: req.ctx.uuid, message: shortName + ' organization could not be updated in MongoDB because it does not exist.' })
400400
return res.status(404).json(error.orgDnePathParam(shortName))
401401
}
@@ -719,7 +719,7 @@ async function updateUser (req, res, next) {
719719
newUser.authority.active_roles = duplicateCheckedRoles
720720

721721
let result = await userRepo.updateByUserNameAndOrgUUID(username, orgUUID, newUser)
722-
if (result.n === 0) {
722+
if (result.matchedCount === 0) {
723723
logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + username + ' does not exist for ' + shortName + ' organization.' })
724724
return res.status(404).json(error.userDne(username))
725725
}
@@ -794,7 +794,7 @@ async function resetSecret (req, res, next) {
794794
const randomKey = cryptoRandomString({ length: getConstants().CRYPTO_RANDOM_STRING_LENGTH })
795795
oldUser.secret = await argon2.hash(randomKey) // store in db
796796
const user = await userRepo.updateByUserNameAndOrgUUID(oldUser.username, orgUUID, oldUser)
797-
if (user.n === 0) {
797+
if (user.matchedCount === 0) {
798798
logger.info({ uuid: req.ctx.uuid, message: 'The user could not be updated because ' + username + ' does not exist for ' + orgShortName + ' organization.' })
799799
return res.status(404).json(error.userDne(username))
800800
}

0 commit comments

Comments
 (0)