S
S
SalimILE2016-08-31 17:14:45
MongoDB
SalimILE, 2016-08-31 17:14:45

Indexes in MongoDB?

Good afternoon!
I would like to ask.
For example, there is a collection = {name, age}
I create indexes
db.users.createIndex( { name: 1, age: -1 } )
When I start the application, db.users.createIndex( { name: 1, age: -1 }) is always executed ) (Well, logically)
Does this affect performance?
Maybe I need to first create indexes through mongo in the terminal?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2016-08-31
@SalimILE

If you call multiple createIndex() methods with the same index specification at the same time, only the first operation will succeed, all other operations will have no effect.

https://docs.mongodb.com/manual/reference/method/d... Does
n't affect anything at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question