I\'m using mongoDB for the first time in a RESTful service. Previously the id column in my SQL databases was an incrementing integer so my RESTful endpoints would look somet
It's wiser to use the ObjectId
s, because keeping an incrementing counter can be a bottleneck. Also, since ObjectId
contains a timestamp and is monotonic, they can be helpful in optimizing queries.
The ObjectIds
can be guessed, but since that is definitely true for incrementing IDs, I suspect you didn't rely on security through obscurity before, so that's no trouble for you.
A downside, albeit a small one, is that the creation time on your server leaks to the user, i.e. if the user is able to identify this as an ObjectId
, she can reverse-engineer the creation time of the object. That's the only potential issue I see.