-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection ignoring the compressors
option
#14885
Comments
I've seen this ranging from node 16 and mongoose 5, to the latest bun canary and mongoose@latest |
I'm unable to repro. RUnning the following script:
and I get the following output, which includes the
Can you please clarify what you mean by "configuring my connection to use network compression" with a code sample? |
const options = mongoURI.includes('localhost') ?
{} : { compressors: ['zstd', 'snappy', 'zlib'] } as ConnectOptions
export default (startTime: number) => mongoose.connect(mongoURI, options)
.then(async mongoose => {
const serverStatus = await mongoose.connection.db!.command({ hello: 1 })
console.log(Object.keys(serverStatus).includes('compressors') ? '🟢 Compression enabled' : '🔴 Compression disabled')
})
.then(() => console.log(`🟢 Connected to MongoDB in ${(performance.now() - startTime).toFixed(2)}ms`))
.catch((err) => { console.error('❌ MongoDB connection error:', err, '\nQuiting now... 💀'); process.exit(2) }) |
OK, I can see the problem is in the URL, actually... I'll try to post it while anonymizing it
Maybe that URL is malformed or somehow impedes the |
Is it possible that your mongoURI includes |
No, it's a Mongo Atlas URL. No "localhost" there |
Have you tried setting |
Yes I have. Same results. |
What permissions and roles does the database user have on your Atlas DB? Maybe for some reason |
It's the driver actually who rejects the |
Ah ok I see what the issue might be. You're checking for the |
Prerequisites
Mongoose version
8.6.1
Node.js version
latest
MongoDB server version
6.8.0
Typescript version (if applicable)
No response
Description
I tried configuring my connection to use network compression with the following option:
and then verifying it is actually applied using
but there is no compressors section at all. These are the top level properties of the output (not showing the whole thing for security reasons):
Steps to Reproduce
As shown in description
Expected Behavior
I should be seeing the actual compression algorithm negotiated between de driver and the server
The text was updated successfully, but these errors were encountered: