Buat kunci utama di MongoDB
db.members.createIndex( { "user_id": 1 }, { unique: true } )
db.members.insert({'user_id':1,'name':'nanhe'})
db.members.insert({'name':'kumar'})
db.members.find();
db.members.insert({'user_id':1,'name':'aarush'}) -- getting error
Tiny Coders