diff --git a/docs/reference/create-client.txt b/docs/reference/create-client.txt index f54805651a..b4ea052380 100644 --- a/docs/reference/create-client.txt +++ b/docs/reference/create-client.txt @@ -517,6 +517,12 @@ Ruby Options - ``Array`` - none + * - ``:warn_compression_disabled`` + - By default, the driver warns if you have not set the ``:compressors`` option. + Set this option ``false`` to silence the warning. + - ``true``, ``false`` + - none + * - ``:connect`` - **Deprecated.** Disables deployment topology discovery normally performed by the dirver and forces the cluster topology to a specific diff --git a/lib/mongo/client.rb b/lib/mongo/client.rb index e06231d4ad..8eb43e6dcf 100644 --- a/lib/mongo/client.rb +++ b/lib/mongo/client.rb @@ -1353,6 +1353,13 @@ def validate_new_options!(opts) end _options end + + unless !opts[:compressors]&.empty? || + opts[:warn_compression_disabled] == false || + @@warned_compression_disabled + log_warn("Compression is disabled. Refer to: https://www.mongodb.com/docs/ruby-driver/current/reference/create-client/#compression. You may silence this warning by setting :warn_compression_disabled = false.") + @@warned_compression_disabled = true + end end # Validates all options after they are set on the client.