Mongoexport --fieldFile error: Failed: open fields.txt

To add to steevej update
You need not run mongoexport from bin dir as long as your PATH is updated with mongodb/bin
You can run it from anywhere
So easiest is cd to the dir where your field_name.txt is residing then run the command without giving full path.The space between your name “Arindam PC” was the issue as Steeve identified
Double quotes on out is also not needed as there are no spaces in that path

steevj Steeve Juneau
You have rightly pointed out that I used some extra space between every pair of dashes while I write the command - line option of mongoexport to get csv output. It is also true that it is easier to edit on notepad editor rather than command directory.

Ramchandra_Tumula

You need not run mongoexport from the bin directory as long as your path is updated with mongodb / bin.
You can run it from anywhere. So easiest way is cd to your directory where your field_name.txt is residing , then run the command without giving full path.

The path directory of my MongoDB Server is
C:\Program Files\MongoDB\Server\4.4\bin

Mongoexport is : C:\Program Files\MongoDB\100\Tools\bin

field_name.txt file is : C:\Users\Arindam PC\Documents\field_name

So , all are in different directories. My monogoexport is not bundled with same MongoDB Server 4.4 . It is installed separately not in the same bin directory of MongoDB Server.

So , how could I run mongoexport from the same bin directory of MongoDB Sever so long we use cd ( change directory) ?

Also, as I told earlier my field directory is residing at C:\Users\Arindam PC\Documents\field_name .

How could I access from this directory cd to bin directory and run the command without giving full path ?

Lastly , it right that double quote only is needed as there is spaces “Arindam PC” but not required in out as there are no spaces in the path.

Add C:\Program Files\MongoDB\100\Tools\bin to your PATH then you can run mongoexport from any location

1 Like