Reputation: 1977
I have querying a database from two different locations.. The query is identical and the values being passed in are identical. However one query is finding a match, and the other is not.
This Query returns a result
app.models.OrgProvider.find( {where: { orgId: data.orgId, providertypeId: data.typeID}, include: 'provider' }, function(err, orgprovider){
//data.providerId = orgprovider[0].toJSON().provider.id;
console.log('find provider via Create: ' + orgprovider);
console.log('orgId: ' + data.orgId);
console.log('providertypeId: ' + data.typeID);
callback(null, data);
});
outputs to console
find provider via Create: [object Object]
orgId: 5a029ead07e76372952b4ca0
providertypeId: 1
This Query returns EMPTY
app.models.OrgProvider.find( {where: { orgId: ticket.orgId, providertypeId: typeID}, include: 'provider' }, function(err, orgprovider){
//data.providerId = orgprovider[0].toJSON().provider.id;
console.log('find provider via reAllocate: ' + orgprovider);
console.log('orgId: ' + ticket.orgId);
console.log('providertypeId: ' + typeID);
cb(null,ticket);
});
outputs to console
find provider via reAllocate:
orgId: 5a029ead07e76372952b4ca0
providertypeId: 1
Paramaters being passed into the find are identical, and yet one is returning a result and the other isn't
Is there a way I can inspect the query for that is being sent to the Database to determine the difference? Or any suggestions on why I would be getting different results?
Many Thanks in advance
Upvotes: 0
Views: 72
Reputation:
Is there a way I can inspect the query for that is being sent to the Database to determine the difference?
https://loopback.io/doc/en/lb3/Setting-debug-strings.html
Linux and probably MACOS
DEBUG=loopback:connector:mongodb node .
Windows
set DEBUG=loopback:connector:mongodb
node .
Upvotes: 1