Perform dump with compression...
$ mongodump -dtest --gzip 2015-06-22T14:36:40.019-0400 writing test.system.indexes to dump/test/system.indexes.bson 2015-06-22T14:36:40.021-0400 writing test.a to dump/test/a.bson 2015-06-22T14:36:40.021-0400 writing test.b to dump/test/b.bson 2015-06-22T14:36:40.023-0400 done dumping test.a 2015-06-22T14:36:40.023-0400 done dumping test.b
...view directory files produced:
$ ls -al dump/test/ total 68K drwxrwxr-x 2 wisdom wisdom 4.0K Jun 22 14:36 ./ drwxrwxr-x 3 wisdom wisdom 4.0K Jun 22 14:36 ../ -rw-rw-r-- 1 wisdom wisdom 47 Jun 22 14:36 a.bson.gz -rw-rw-r-- 1 wisdom wisdom 93 Jun 22 14:36 a.metadata.json.gz -rw-rw-r-- 1 wisdom wisdom 47 Jun 22 14:36 b.bson.gz -rw-rw-r-- 1 wisdom wisdom 93 Jun 22 14:36 b.metadata.json.gz -rw-rw-r-- 1 wisdom wisdom 79 Jun 22 14:36 system.indexes.bson.gz
Note the absence of the .gz suffix.
It would also be helpful if during restore, we produced a helpful error message when a user attempts to restore compressed data without supplying --gzip
$ mongorestore 2015-06-22T14:39:24.884-0400 using default 'dump' directory 2015-06-22T14:39:24.885-0400 building a list of dbs and collections to restore from dump dir 2015-06-22T14:39:24.885-0400 don't know what to do with file "dump/test/a.bson.gz", skipping... 2015-06-22T14:39:24.885-0400 don't know what to do with file "dump/test/a.metadata.json.gz", skipping... 2015-06-22T14:39:24.885-0400 don't know what to do with file "dump/test/b.bson.gz", skipping... 2015-06-22T14:39:24.885-0400 don't know what to do with file "dump/test/b.metadata.json.gz", skipping... 2015-06-22T14:39:24.885-0400 don't know what to do with file "dump/test/system.indexes.bson.gz", skipping... 2015-06-22T14:39:24.885-0400 done