MongoDB uses the snappy compression algorithm by default to compress data and prefixes for indexes. Index-prefixed compression means that identical index key prefixes are stored only once per page of memory. Compression not only reduces our storage footprint, but will increase I/O operations per second, as less data needs to be stored and moved to and from disk. Using more aggressive compression can lead to performance gains if our workload is I/O bound and not CPU bound.
We can define .zlib compression instead of snappy or no compression by setting the following parameter to false:
storage.wiredTiger.collectionConfig.blockCompressor
We can disable index prefixes compression by setting the following parameter to false:
storage.wiredTiger.indexConfig.prefixCompression
We can also configure storage per-index during creation using the following parameter:
{ <storage-engine-name>: <options> }