Enable Block Compression on existing data, Possible?

Hi there; I created a database in my ReplicaSet and a collection as well. After a while the size of Data is growing fast and now (with existing data) I need to enable zstd compression method on my existing collection.
I use ops manager to simply change config. the storage engine is WiredTiger and the size of data is about 1TB (over than 80% of disk)
The question is that is it possible to MODIFY the Deployment (ReplicaSet), Add Option: wiredTigerCollectionBlockCompressor with the value: zstd and then DEPLOY the changes to the ReplicaSet.
Does it work properly? I guess after compact it should be OK and the size of used disk will be reduced.

The version of MongoDB : 4.2.6

No answer yet!
Is it possible to enable compression after inserted Documents?

Hi @maryam_da welcome to the community!

Compression settings are observed only during collection creation (see Compression).

You can also set it to be globally observed using the config option storage.wiredTiger.collectionConfig.blockCompressor.

However, changing this setting will only affect new collections. Existing collections are still using the old compression scheme:

storage.wiredTiger.collectionConfig.blockCompressor affects all collections created. If you change the value of storage.wiredTiger.collectionConfig.blockCompressor on an existing MongoDB deployment, all new collections will use the specified compressor. Existing collections will continue to use the compressor specified when they were created, or the default compressor at that time.

So to answer your question, once the collection was created, it will keep its compression setting. This is part of the collection’s metadata, and you can’t have half the collection using one compression setting, and another half using a different compression setting. A new collection would have to be created if you want to use a different compression setting (or if you have changed the default).

Best regards
Kevin