0

I always run the compact command on mongodb and it disturb the performance of the DB , do you know if adding Background : true will work ? I'm asking before testing it .

db.runCommand({compact:'OPC_PLANT_DATA'}, {'background' : true})
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • Which version of MonogDB do you run? – Wernfried Domscheit Oct 23 '20 at 13:27
  • MongoDB server version: 4.0.3 – AbdelAziz ESSAADI Oct 23 '20 at 13:34
  • 2
    Then you may upgrade to latest version 4.4, see [compact](https://docs.mongodb.com/manual/reference/command/compact/index.html#behavior): *Starting in v4.4, on WiredTiger, compact only blocks the following metadata operations: db.collection.drop db.collection.createIndex and db.collection.createIndexes db.collection.dropIndex and db.collection.dropIndexes compact does not block MongoDB CRUD Operations for the database it is currently operating on. Starting in v4.4, the compact command is appropriate for use at any time.* – Wernfried Domscheit Oct 23 '20 at 14:00

0 Answers0