Mongoexport is not working for collection

Andre picture Andre · Oct 9, 2014 · Viewed 7.5k times · Source

I am trying to export a Collection like this:

C:\Program Files\ConEmu>mongoexport --db test --collection person --out personTest.json
connected to: 127.0.0.1
couldn't open [personTest.json]

It is not working. Any suggestions?

Answer

CodeCaster picture CodeCaster · Oct 9, 2014

You most likely are doing this from a non-elevated command prompt, and are denied to write in Program Files.

You can:

  • Supply a full path to a directory where you can write, --out C:\Temp\personTest.json
  • cd to a directory where you can write and call the executable by full path: C:\Program Files\ConEmu\mongoexport ...
  • Execute your command from an elevated prompt.