Automattic / mongoose

MongoDB object modeling designed to work in an asynchronous environment.
https://mongoosejs.com
MIT License
26.97k stars 3.84k forks source link

can not specify zstd compression level #14807

Open KhaledMosaad opened 3 months ago

KhaledMosaad commented 3 months ago

Prerequisites

Issue

I want to use zstd compression lib on the compressors connection option but can not specify the level of the compression it should be from 1 to 22, I see that the default value for this compression is 3 on node-mongodb-native and it's a constant static value can not be specified

vkarpov15 commented 3 months ago

I did some digging and it looks like this option is hard-coded by the MongoDB Node driver: https://github.com/mongodb/node-mongodb-native/pull/3237#discussion_r871505988. I opened an issue in MongoDB JIRA here: https://jira.mongodb.org/browse/NODE-6336

nbbeeken commented 3 months ago

@KhaledMosaad Can you elaborate on the use case for adjusting the level? Of course, I assume it is to either decrease payload size or increase speed, I am curious which is the primary motivator. Would you have use for levels above 19? (asking in reference to the increased memory to support above 19). Thanks in advance!

KhaledMosaad commented 3 months ago

I did some digging and it looks like this option is hard-coded by the MongoDB Node driver: mongodb/node-mongodb-native#3237 (comment). I opened an issue in MongoDB JIRA here: https://jira.mongodb.org/browse/NODE-6336

Thank you for your effort @vkarpov15

KhaledMosaad commented 3 months ago

@KhaledMosaad Can you elaborate on the use case for adjusting the level? Of course, I assume it is to either decrease payload size or increase speed, I am curious which is the primary motivator. Would you have use for levels above 19? (asking in reference to the increased memory to support above 19). Thanks in advance!

@nbbeeken Frankly speaking, I do not intend to use compression of 19 or above. Currently, I am in the testing phase to determine the optimal performance and payload size for our use case. Our goal is to reduce the payload size to minimize data transfer from MongoDB atlas, thereby cutting costs.