I’d like to give each ‘order’ (document) in an ‘orders’ collection a more human friendly unique identifier for use in an ecommerce app, where the customer would see their order ID and potentially need to reference in over the phone.
I think the default mongo IDs are just a little unwieldy for users (XZ62ARbFwqaYHFLtz), especially the use of mixed-case letters is quite difficult to say over the phone “upper case X, upper case Z, … lower case B etc”…
I’m thinking either 1. A auto-incremented numeric ID or 2. A more simple ID format - case insensitive and possibly a few characters shorter.
Has anyone implemented anything like this already? Any suggestions for how to approach it? I realise there are difficulties with both approaches. What about using the timestamp for when the document is created and hashing it? What problems might I run into?
Thanks!