Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I want to create Index on Mongo database for performance perspective, so could you please help me how I can do it?

Your help will be appreciated here.

1 Answer

0 votes
by (106k points)

To create an index on MongoDB you can use the below-mentioned query:

db.collection.createIndex(keys, options)

So, for example:

$ db.users.createIndex({"username" : 1})

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...