Mongoexport is not working for collection Mongoexport is not working for collection mongodb mongodb

Mongoexport is not working for collection


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.


You do not have write permission in this directory.Change your current location to your home directory or some other directory where you have write permission.e.g My Documents, or Desktop , or user/Andre


You need to do the following things

1.Goto C:\Program Files\MongoDB\Server\3.2\bin or it should be any path other than mongo shell.2. If you are in this C:\Program Files\MongoDB\Server\3.2\bin path and trying to export collection then you need to run this query mongoexport --db test --collection special --out E:\spec.json . After --out you need to mention path where the exported file needs to store. If you doesn't provide this it will try to store in current directory. In some systems , drive c has root permissions so at this time it will not allow you to store file.For that you need to give paths of other drive's other than this C drive.

3.If you are using other paths it is your wish to set the path for exporting file.You can use mongoexport --db test --collection special --out E:\spec.json. or mongoexport --db test --collection special --out spec.json.4.Check into the destination path for exported file.

Hope it helps.