I have a model with a number of properties. One of them is a field called "developerId" that contains a string that has the same length and characteristics as the MongoDB ObjectId (actually a gated ObjectId).
When I request a model with the find () method in Node.js, the request is updated before it is executed, and the value "DeveloperId" is converted to ObjectId, which then cannot match any rows in the database, these are strings, not ObjectIds.
{where: {developerId: '55118c5fc921fa170f05080b'}}
Converted to:
{where: {developerId: ObjectId('55118c5fc921fa170f05080b')}}
The field is not an id field; it is set as type: 'string' in the json model definition.
How to disable this auto-object-id object behavior so that I have control over Loopback requests?
mongodb loopbackjs
Rob evans
source share