Maintain a unique field while indexing - equivalent to a UNIQUE INDEX in a relational database

Cool!

I understand your suggestion, but is there a way to do it, without setting the id to be the email?
I want to keep the auto generated id, and use a separate field for email.

Is my suggestion(original question) is valid? is there a better way to do it?