I have the same error message and the solution for me was to edit model-config.json with the value for "datasourse" on my entity:
"cat": { "dataSource": "mydb", "public": true }
All files:
model-config.json
{ "_meta": { "sources": [ "loopback/common/models", "loopback/server/models", "../common/models", "./models" ], "mixins": [ "loopback/common/mixins", "loopback/server/mixins", "../common/mixins", "./mixins" ] }, "cat": { "dataSource": "mydb", "public": true } }
datasourse.json
{ "mydb": { "host": "localhost", "port": 27017, "url": "", "database": "test", "password": "", "name": "", "user": "", "connector": "mongodb" } }
I am working on an example with loopback 3.x and I had to install the following node package to enable connection with mongodb
npm install loopback-connector-mongodb --save
If you need more information, you can refer to the official document at https://loopback.io/doc/en/lb3/MongoDB-connector.html
source share