How does mongoexport work?

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]

      

He does not work. Any suggestions?

+3


source to share


3 answers


Most likely you are doing this from the command line with an unfulfilled value and cannot write to Program Files.

You can:



  • Put the full path to the directory where you can write, --out C:\Temp\personTest.json

  • cd

    to a directory where you can write and call the executable in full path: C:\Program Files\ConEmu\mongoexport ...

  • Run the command from an elevated prompt.
+8


source


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



+1


source


You need to do the following:

1.Goto C:\Program Files\MongoDB\Server\3.2\bin

or it must be any path other than mongo shell. 2. If you are in this directory C: \ Program Files \ MongoDB \ Server \ 3.2 \ bin and are trying to export a collection, you need to run this query mongoexport --db test --collection special --out E:\spec.json

. After that, you must specify the path in which the exported file should be stored. If you don't, it will try to save in the current directory. On some systems, drive c is root, so it will not allow you to store the file at this time. To do this, you need to specify the paths of another drive besides this one C drive

.

3.If you are using other paths, you want to set the path to export the file. You can use mongoexport --db test --collection special --out E:\spec.json

. or mongoexport --db test --collection special --out spec.json

. 4.Check the destination path for the exported file.

Hope it helps.

0


source







All Articles