You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// show method from ProductController.jsasyncshow({params, response}){constproduct=awaitProduct.where('_id',params.id).fetch()returnresponse.json(product)}
When I try to send a GET request http://127.0.0.1:3333/v1/products/123456 I get an error:
Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
If I try to find it by Mongo console (db.products.find({_id: "123456"})) it works fine.
How can I use in controller/router custom _id?
The text was updated successfully, but these errors were encountered:
Hi. I have products with custom, unique 6-chars ID (for example
123456
).I added test product by MongoDB console:
My Adonis files:
When I try to send a GET request
http://127.0.0.1:3333/v1/products/123456
I get an error:If I try to find it by Mongo console (
db.products.find({_id: "123456"})
) it works fine.How can I use in controller/router custom
_id
?The text was updated successfully, but these errors were encountered: