diff --git a/source/connect.txt b/source/connect.txt index ad229d04..e140716f 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -31,7 +31,6 @@ Connect to MongoDB Stable API Limit Server Execution Time Connection Pools - Compression Overview -------- diff --git a/source/connect/compression.txt b/source/connect/compression.txt deleted file mode 100644 index 55946c83..00000000 --- a/source/connect/compression.txt +++ /dev/null @@ -1,89 +0,0 @@ -.. _pymongo-compression: - -=========== -Compression -=========== - -.. facet:: - :name: genre - :values: reference - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -Overview --------- - -In this guide, you can learn how to use compression algorithms with -{+driver-short+}. - -You can use compression to reduce the size of messages sent between your application -and a MongoDB deployment. {+driver-short+} supports the following compression algorithms: - -- `Snappy `__: You can use Snappy compression - with MongoDB 3.4 and later by including the `python-snappy `__ - package in your application. -- `Zlib `__: You can use Zlib compression with MongoDB 3.6 and later - by including the `zlib `__ package - in your application. -- `Zstandard `__: You can use Zstandard compression - with MongoDB 4.2 and later by including the `zstandard `__ - package in your application. - -Specifying Compression By Using a Connection String ---------------------------------------------------- - -You can specify the compression algorithm to use by including the ``compressors`` option -in your connection string. The following example specifies the Snappy compression algorithm - -.. code-block:: python - - client = pymongo.MongoClient("mongodb://localhost/?compressors=snappy") - -You can also specify multiple compression algorithms by separating them with a comma, as -show in the following example: - -.. code-block:: python - - client = pymongo.MongoClient("mongodb://localhost/?compressors=snappy,zlib,zstd") - -.. note:: - - When you supply multiple compression algorithms to a connection string, - {+driver-short+} uses the first compression algorithm in the list that the - deployment supports. - -Specifying Compression to a MongoClient ---------------------------------------- - -You can also specify the compression algorithm to use by passing the algorithms to use -to the ``compressors`` parameter of the ``MongoClient`` constructor, as shown in the -following example: - -.. code-block:: python - - client = pymongo.MongoClient(compressors="snappy") - -You can also specify multiple compression algorithms by passing a list of algorithms to the -``MongoClient`` constructor, as shown in the following example: - -.. code-block:: python - - client = pymongo.MongoClient(compressors=["snappy", "zlib", "zstd"]) - -.. note:: - - When you supply multiple compression algorithms to a ``MongoClient``, - {+driver-short+} uses the first compression algorithm in the list that the - deployment supports. - -API Documentation ------------------ - -To learn more about any of the methods or types discussed in this -guide, see the following API documentation: - -- `MongoClient <{+api-root+}pymongo/mongo_client.html#pymongo.mongo_client.MongoClient>`__ \ No newline at end of file diff --git a/source/connect/network-compression.txt b/source/connect/network-compression.txt index 0cc60ecb..8348fdfe 100644 --- a/source/connect/network-compression.txt +++ b/source/connect/network-compression.txt @@ -91,3 +91,10 @@ The following code example specifies the ``zlib`` compression algorithm and a va "compressors=zlib" "zlibCompressionLevel=1") client = pymongo.MongoClient(uri) + +API Documentation +----------------- + +To learn more about any of the methods or types discussed in this +guide, see the `MongoClient <{+api-root+}pymongo/mongo_client.html#pymongo.mongo_client.MongoClient>`__ +API documentation. \ No newline at end of file