I want to export a mongodb collection without a value, I've tried using the mongodb compass but it's not quite what I want
Unfortunately, that's not implemented in mongodump.
You'd have to make a full database dump, and trim afterwards so you're only left with *.metadata.json.
On the Linux / Mac / *nix command line, you can do:
mongodump --out=mydumpdir
rm mydumpdir/*/*.bson
You can then import it elsewhere using mongorestore mydumpdir.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With