I have a special need to hash the username, and also I need to keep the usernames unique for my purpose. So, my question is can I override default '_id' field of mongoDB with sha256 hash of username? I read that _id needs to be unique and already indexed, so why would I want to create another entry instead of storing in _id.
Does this cause any technical problems which I'm unaware of? Is it efficient when searching _id as it is indexed?
This application is a Flask application using Flask-pymongo as mongo driver and helper.
By default:
_id : ObjectId(...)
I need:
_id : sha256(username)
Please explain if there are any issues with this approach.