When we create a new collection, we can pass in options to WiredTiger like this:
> db.createCollection(
"mongo_books",
{ storageEngine: { wiredTiger: { configString: "<key>=<value>" } } }
)
This helps to create our mongo_books collection with a key-value pair from the available ones that WiredTiger exposes through its API. Some of the most widely used key-value pairs are the following:
Key |
Value |
block_allocation |
Best or first |
allocation_size |
512 bytes through to 4 KB; default 4 KB |
block_compressor |
None, .lz4, .snappy, .zlib, .zstd, or custom compressor identifier string depending on configuration |
memory_page_max |
512 bytes through to 10 TB; default 5 MB |
os_cache_max |
Integer greater than zero; default zero |
This is taken directly from the definition in the WiredTiger documents located at http://source.wiredtiger.com/mongodb-3.4/struct_w_t___s_e_s_s_i_o_n.html:
int WT_SESSION::create()
Collection-level options allow for flexibility in configuring storage but should be used with extreme care and after careful testing in development/staging environments.