1

I have a loopback model as

{ "name": "myModel", "base": "PersistedModel", "idInjection": true, "options": { "validateUpsert": true }, "properties": { "name": { "type": "string", "description": "Channel name" } }, "validations": [], "relations": {}, "acls": [], "methods": {} }

Now this is connected to a mongodb collection.This collection can have custom id in numeric like 1234 or Mongodb ObjectId when created using loopback.

Now when I query using GET http://localhost:3000/api/myModel/1234.It is not able to get the object of that id.

I get an error message as {"status":404,"statusCode":404,"code":"MODEL_NOT_FOUND","message": "Unknown \"myModel\" id \"1234\"}

If my id is alphanumeric like abcd1234 then I dont get this error.Is there a way in loopback to be able to process a numeric id. The only reference I have is this that suggests to use alphanumeric ids.

dhrDatt
  • 1,008
  • 3
  • 10
  • 19

0 Answers0