How to make user's email unique in mongoDB?
Use unique keyword, or simply make _id value to be email.
db.collection.createIndex( { email: 1 }, { unique: true } )
You can do it by creating a unique index for your email field.
http://docs.mongodb.org/manual/tutorial/create-a-unique-index/
Mongodb ensureIndex
has been deprecated, use createIndex
instead.
db.collection.createIndex( { email: 1 }, { unique: true } )