Hello! I am trying to export a large collection named ‘questions’ from a database named ‘sc_data’ on my localhost. I have created a json file named questions.json in a folder named db_transfer on my desktop for storage. I have the latest version of mongodb_database_tools and mongodb-community version 5.0.4 installed on my machine.
I am running this command in my terminal:
mongoexport --collection questions --db sc_data --out /Users/bonnieowens/desktop/db_transfer/questions.json
and getting this response:
connected to: mongodb://localhost/
exported 0 records
I can see in Compass that I have that db in localhost and I have that collection in the db, and it is not empty.
I have tried specifying the port (–port 27017) and using the syntax in the docs (–db=sc_data). I am sure that it’s a simple error, but I can’t find it.
I’m not entirely sure why, but restarting my computer and then restarting mongodb-community that I had running in the background fixed this issue. I thought I would share in case someone else experiences the same issue.