Docs Menu
Docs Home
/ / /
C#/.NET
/ /

Network Compression

You can enable a driver option to compress messages, which reduces the amount of data passed over the network between MongoDB and your application.

The .NET/C# Driver supports the following compression algorithms:

  1. Snappy: available in MongoDB 3.6 and later.

  2. Zlib: available in MongoDB 3.6 and later.

  3. Zstandard: available in MongoDB 4.2 and later.

If you specify multiple compression algorithms, the driver selects the first one in the list supported by your MongoDB instance.

To enable compression for the connection to your MongoDB instance, specify the algorithms you want to use in one of the following ways:

  1. Add the algorithms to your connection string as a parameter

  2. Specify the algorithms in the Compressors property of your MongoClientSettings object

← Enable TLS on a Connection