From 1654e458d5b26f34a00a31d5e1b6097749cf1d72 Mon Sep 17 00:00:00 2001 From: "vivek.kumar3" Date: Wed, 15 May 2024 17:48:53 +0530 Subject: [PATCH] #1524 fix --- lib/services/groups/groupRegistryMongoDB.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/services/groups/groupRegistryMongoDB.js b/lib/services/groups/groupRegistryMongoDB.js index 740a3fad7..44ff3107b 100644 --- a/lib/services/groups/groupRegistryMongoDB.js +++ b/lib/services/groups/groupRegistryMongoDB.js @@ -216,7 +216,9 @@ function find(service, subservice, callback) { } function findOneInMongoDB(queryObj, fields, callback) { - const query = Group.model.findOne(queryObj); + const query = Group.model.findOne({ + $or: [{ apikey: queryObj.apikey }, { type: queryObj.type }] + }); query.select({ __v: 0 }); query.lean().exec(function handleGet(error, data) { if (error) { @@ -224,6 +226,7 @@ function findOneInMongoDB(queryObj, fields, callback) { callback(new errors.InternalDbError(error)); } else if (data) { context = fillService(context, data); + queryObj.resource = data.resource; logger.debug(context, 'Device group data found: %j', data); callback(null, data); } else {