2

I am trying to use network compression feature of mongoDb using golang, I am trying to use Zstd compression, and I am using the following method at the time of db connection,

opts := options.Client().ApplyURI("mongodb://" + ipPort).SetConnectTimeout(5 * time.Second).SetCompressors([]string{"zstd"})

While checking the db logs, I found an message with the db connection logs,

Compression negotiation not requested by client

Can you please help me, why this message is shown? Is there any problem with the db connection? Will it make any impact on MongoDb queries?

sahil garg
  • 89
  • 5
  • I'm not a go developer, so some clarification questions: 1. how the mongoClientSettings do look like after you apply this configuration, im particular do you see a compressions list there? 2. Does this connection string "mongodb://" + ipPort + "?compressors=zstd" work for you? – dododo Jan 13 '23 at 14:47
  • there was a seprate options package in golang, by which we can define additional options for connection client, I have used the SetCompressors method of that file. – sahil garg Jan 17 '23 at 10:39
  • try configuring it as I wrote above via raw mongo go driver – dododo Jan 17 '23 at 10:47

0 Answers0