Search code examples
mongodbmongoexport

Mongoexport is not working for collection


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?


Solution

  • 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.