This might sound like a trivial question, but it is rather important for consumer facing apps
What is the easiest way and most scalable way to map the scary mongo id onto a id that is friendly?
xx.com/posts/4d371056183b5e09b20001f9
TO
xx.com/posts/a
M
Define a friendly unique field (like a slug) on your collection, index it, on your model, define
to_paramto return it:Then in your finders, find by slug rather than ID:
This will let you treat slugs as your effective PK for the purposes of resource interaction, and they’re a lot prettier.