I am using PHP + MongoDB. Is it possible to have shorter Id for a record or shorter unique Id for a record? When I use Id in URL, it is too long. I want it to be shorter. Please advice.
Asked
Active
Viewed 110 times
0
-
The IDs are that length for a reason. http://docs.mongodb.org/manual/reference/glossary/#term-objectid – sevenseacat Jan 03 '14 at 06:17
-
1While not exactly your question, this might be helpful: http://stackoverflow.com/a/19031308/95190 – WiredPrairie Jan 03 '14 at 11:55
1 Answers
1
As rightly said by @sevenseacat, the ObjectIDs can't be cut short.
Instead, you can always override your _id
value to a user-defined number or string. This would allow you to have a smaller value that you can pass in a URL.

jmikola
- 6,892
- 1
- 31
- 61

Hannan Shaik
- 1,298
- 2
- 14
- 27