MongoDB Buat Indeks Unik

db.members.createIndex( { "user_id": 1 }, { unique: true } )
Upvote answer :-)