cara menambahkan indeks ke koleksi yang ada mongodb
//createIndex adds creates new indexing to existing collections indexes
db.collection.createIndex(
{
"a": 1
},
{
unique: true,
sparse: true,
expireAfterSeconds: 3600
}
)
Upvote answer :-)