what's the best way to bind a mongodb doc to a node.js html page

In past with my PHP / Rails - MYSQL apps I've used the unique ID of a table record to keep track of a record in an html file.

So I'd keep track of how to delete a record shown like this (15 being the ID of the record):

<a href="/profile/delete/15">Delete this record</a>

So now I'm using MongoDB. I've tried the same method but the objectID ._id attribute seems to be a loooong byte string that I can't use conveniently.

What's the most sensible way of binding a link in the view to a record (for deletion, or other purposes or whatever)?

If the answer is to create a new id that's unique for each document in the collection, then what's the best way to generate those unique id's?

Thank you.

You could use a counter instead of the ObjectID

But this could create a problem when inserting a new document after you deleted a previous one. See this blog post for more detail info on Sequential unique identifiers with Node.js and MongoDB.

Or you could use the timestamp part of the ObjectID:

objectId.getTimestamp().toString()

See the node objectid docs