Reputation: 21
I want to create Index in mongodb , but with the classic method
db.OPC_PLANT_DATA.createIndex( { "ITEM_ID" : 1.0,"ITEM_TIMESTAMP" : -1.0 } )
the db get stucked and it takes lot of time , so if I want to do it in Production it will impcat all the work !!
Someone knows how to do it without having any impact on documents insertion ??
Upvotes: 1
Views: 1985
Reputation: 42481
Mongo Db allowed creation of indices in background. You had to specify background:true
option while creating an index.
This was deprecated in version 4.2 of mongo though because they've optimized the index creation process.
Read the relevant documentation chapter
Upvotes: 1