MongoDB 3.4 and newer servers can negotiate network compression if MongoDB clients/drivers have also been updated to support the compressed message format. Network compression was introduced as an optional feature in MongoDB 3.4 and is enabled by default for MongoDB 3.6+ servers.
mgo driver used by
mongodump (as at MongoDB 4.0) does not support network compression and is no longer actively maintained. The expected outcome is that
mongodump data transfer will roughly match your
dataSize (plus some network overhead).
An officially supported MongoDB Go driver is currently in development and will include full support for the latest MongoDB features. Once the new Go driver is ready, the server command line tools will be updated to be able to take advantage of additional options. A relevant issue to upvote/watch in the MongoDB issue tracker is TOOLS-1668 (Support wire protocol compression in mongodump and mongorestore).
In the interim there are a few possible workarounds if network compression will significantly improve your transfer time to a remote server:
- Copy the gzipped
mongodump file to your remote server and restore locally
- Use an SSH or VPN connection which supports network compression