Command
db.users.createIndex({name:1})
Explanation
Creates an index on a collection field to improve query performance. Useful for large collections.
Examples
Create index on item field
db.orders.createIndex({item:1})
db.users.createIndex({name:1})
Creates an index on a collection field to improve query performance. Useful for large collections.
Create index on item field
db.orders.createIndex({item:1})