Skip to content

Commit

Permalink
Merge 1654e45 into 323955f
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekNEC committed May 15, 2024
2 parents 323955f + 1654e45 commit 0c73c5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/services/groups/groupRegistryMongoDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,17 @@ 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) {
logger.debug(context, 'Internal MongoDB Error getting group: %s', error);
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 {
Expand Down

0 comments on commit 0c73c5a

Please sign in to comment.