Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekNEC committed May 15, 2024
1 parent 323955f commit 1654e45
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 1654e45

Please sign in to comment.