user663724
user663724

Reputation:

What might be the result of updating an Index with new field of a collection in MongoDB?

We are using MongoDB as database which is a busy Web Application. Busy in sense 800 concurrent users, every second there would be 50-70 or more updations on MongoDB.

The application is already in place and is not from scratch (the indexes on Mongodb collections have been already created) when I took over this Application.

We recently had a new functionality developed and we added some new fields/attributes to one of our collection in mongodb.

My question is that can I update the index (add a new field to it) to the existing index of the collection?

I was confused and asking because I read that Rebuilding an index might be costly and slow down the application for some databases like Oracle.

Upvotes: 1

Views: 75

Answers (1)

JohnnyHK
JohnnyHK

Reputation: 312035

No, you cannot modify existing MongoDB indexes. For a case like this it's probably best to create the new index in the background (the {background: true} option), and then drop the existing index when the new one has finished building.

Upvotes: 2

Related Questions