Welcome to the community @Asmaa_Hamdi!
This option is for network compression, so isn’t directly related to the compression used for collections on disk. Network compression and on-disk compression can use different compressors.
Can you confirm if the collection you are referencing was created before changing the blockCompressor
option in your MongoDB config file? The blockCompressor
option sets the default compressor for newly created collections but does not affect existing collections.
If you want to compare the effect of different compressors for your data, you can also pass block_compressor
as a storage engine option when creating a collection.
Here’s a quick example in the mongo
shell:
// Create new collection using zstd compression
> db.createCollection("zlogs", {storageEngine: {wiredTiger: {configString: "block_compressor=zstd"}}})
{ "ok" : 1 }
// Check which block compressor is being used for a collection
> var wt_options = db.zlogs.stats().wiredTiger.creationString.split(',')
> wt_options.filter((wt_options) => wt_options.startsWith('block_compressor'))
[ "block_compressor=zstd" ]
The .NET driver has an analogous CreateCollection
command which supports setting the block compressor via the StorageEngine
property in the CreateCollectionOptions
class.
Regards,
Stennie