Press "Enter" to skip to content

Unique Indexes di MongoDb

0

Membuat Index Unique

 

Single Field

db.collection.createIndex( <key and index type specification>, { unique: true } )

Contoh db.members.createIndex( { "user_id": 1 }, { unique: true } )

Drop Index Unique

db.groups.dropIndex("nama_key")

Contoh db.members.createIndex( "user_id")

Reff