Skip to content

Commit

Permalink
query with lean to ensure simple pojos
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Dec 11, 2024
1 parent 5683029 commit bba90cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/services/devices/deviceRegistryMongoDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function getByNameAndType(name, type, service, servicepath, callback) {
const query = Device.model.findOne(optionsQuery);

query.select({ __v: 0 });

query.lean();
query
.exec({})
.then((data) => {
Expand Down Expand Up @@ -375,7 +375,7 @@ function getDevicesByAttribute(name, value, service, subservice, callback) {

const query = Device.model.find(filter);
query.select({ __v: 0 });

query.lean();
query
.exec({})
.then((devices) => {
Expand Down
13 changes: 1 addition & 12 deletions test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,6 @@ describe('NGSI-v2 - Polling commands', function () {
};

beforeEach(function (done) {
// statusAttributeMock = nock('http://192.168.1.1:1026')
// .matchHeader('fiware-service', 'smartgondor')
// .matchHeader('fiware-servicepath', 'gardens')
// .post(
// '/v2/entities?options=upsert',
// //utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json')
// utils.readExampleFile(
// './test/unit/ngsiv2/examples/contextRequests/updateContextCommandExpired.json' )
// )
// .reply(204);

statusAttributeMock = nock('http://192.168.1.1:1026')
.matchHeader('fiware-service', 'smartgondor')
.matchHeader('fiware-servicepath', 'gardens')
Expand Down Expand Up @@ -393,7 +382,7 @@ describe('NGSI-v2 - Polling commands', function () {
request(options, function (error, response, body) {
setTimeout(function () {
iotAgentLib.commandQueue('smartgondor', 'gardens', 'r2d2', function (error, listCommands) {
//statusAttributeMock.done();
statusAttributeMock.done();
done();
});
}, 300);
Expand Down

0 comments on commit bba90cb

Please sign in to comment.