Mongodump: Unrecognized field 'snapshot'

Add --forceTableScan

Example:

mongodump --forceTableScan -d database_name -o target_directory

http://aug2uag.blogspot.com/2018/08/mongoexport-unrecognized-field-snapshot.html


You certainly have a difference of version between mongodump vs your mongoDB server ( 3.6 vs 4.0).

You can use docker to the rescue :

docker run --rm -v $(pwd):/workdir/ -w /workdir/ mongo:4.0 mongodump -h server -d $database --out /workdir/dump/

With docker you can use a precise version of tools cli without install it.

You can even specify an alias (in .bashrc) :

alias mongodump="docker run --rm -v $(pwd):/workdir/ -w /workdir/ mongo:4.0 mongodump"

Note: The folder where the dump is saved will need to have write permissions so the mongodb user in the container can write to the mounted volume. This can be achieved by manually setting the permissions on the dump folder before running the above command.

In the example above that would be: mkdir -m 777 dump. After the dump is completed then permissions can be modified back to a normal (i.e., sudo chmod 755 dump).