.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MONGOC_DATA_COMPRESSION" "3" "May 07, 2024" "1.27.1" "libmongoc" .sp The following guide explains how data compression support works between the MongoDB server and client. It also shows an example of how to connect to a server with data compression. .SH COMPRESSING DATA TO AND FROM MONGODB .sp MongoDB 3.4 added Snappy compression support, while zlib compression was added in 3.6, and zstd compression in 4.2. To enable compression support the client must be configured with which compressors to use: .INDENT 0.0 .INDENT 3.5 .sp .EX mongoc_client_t *client = NULL; client = mongoc_client_new (\(dqmongodb://localhost:27017/?compressors=snappy,zlib,zstd\(dq); .EE .UNINDENT .UNINDENT .sp The \fBcompressors\fP option specifies the priority order of compressors the client wants to use. Messages are compressed if the client and server share any compressors in common. .sp Note that the compressor used by the server might not be the same compressor as the client used. For example, if the client uses the connection string \fBcompressors=zlib,snappy\fP the client will use \fBzlib\fP compression to send data (if possible), but the server might still reply using \fBsnappy\fP, depending on how the server was configured. .sp The driver must be built with zlib and/or snappy and/or zstd support to enable compression support, any unknown (or not compiled in) compressor value will be ignored. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .