zeus
zeus

Reputation: 13357

Is it possible to compress a particular collection?

This is the configuration of my MongoDB :

systemLog:
  path: "C:\\log\\mg.log"
  logAppend: true
  destination: file
storage:
  dbPath: "c:\\data"
  directoryPerDB: true
  engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1

How can I Instruct the MongoDB engine to compress one particular collection?

Upvotes: 0

Views: 210

Answers (1)

Ivkin Igor
Ivkin Igor

Reputation: 140

Speaking about a particular collection I see two options for you.

  1. You can use a settings of storage when you create collection:

    db.createCollection("your_collection", 
                        { storageEngine: {
                            wiredTiger: {configString: "blockCompressor=zlib"}
                        }})
    
  2. OR you can compress your data on the side of application and store as binary. Probably it's better first to measure how much you will win in both cases.

Upvotes: 1

Related Questions