Jeffrey Teruel
Jeffrey Teruel

Reputation: 364

MongoDB: mongoexport produces blank json and error message

I have a MongoDB dbs named test with a collection named items. It has one item. I'm currently learning how to export a copy of the collections, but I get an error message: Failed: error connecting to db server: no reachable servers and a blank .json document. Below is my command for mongoexport in my terminal (using a Mac):

mongoexport --db test --collection items --authenticationDatabase admin --out test.json

How would I fix this so that I get the data from the collection?

Upvotes: 0

Views: 346

Answers (1)

Alex
Alex

Reputation: 38529

Try adding the host parameter:

mongoexport --host=127.0.0.1 --db test --collection items --authenticationDatabase admin --out test.json

Upvotes: 1

Related Questions