Search code examples
mongodbmongodb-javamongo-shellwiredtiger

Show storage engine config in mongosh


I've created a collection (in Java) with storage engine options where the block compressor should be zstd. How can I verify that .storageEngineOptions() worked as expected? Is it possible through mongosh?


Solution

  • You can use the function db.collection.stats(). You will get a large output, we are interested in creationString key, which is a large string, something like this:

    creationString: 'access_pattern_hint=none,allocation_size=4KB,app_metadata=(formatVersion=1),assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=snappy 
    

    The compression algorithm will be a part of this string.