The mongodump tool seems not to support the option --excludeCollection=someCollection when not specifying the --db someDb option. We would like to dump just all databases without explicitly specifying them but exclude certain collections.

Failed: bad option: --db is required when --excludeCollection is specified

Is there another way to exclude certain collections?

Maybe adding a query file with --queryFile is an option, according to the docs it's not necessary to specify the --collection as with --query. But I couldn't find out how you write a query to do that.

We are using MongoDB 3.6.12.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.