command not found: mongoexport

Chakib Temal picture Chakib Temal · Jun 27, 2017 · Viewed 7.7k times · Source

I use a mongodb database, I am on macOS, the command mongoexport does not pass, I am under the /bin directory of the database

here is my command

mongoexport --db Battleship --collection user --out resultExport.json

my database is Battleship , and the collection is user

any idea \?

Answer

Marcin Orlowski picture Marcin Orlowski · Jun 27, 2017

If mongoexport is in the same directory that your current one (and also is executable and you got perms to execute it) then you need to prepend executable with ./ and invoke it that way:

./mongoexport --db Battleship --collection user --out resultExport.json

Here's more on why you need that for https://askubuntu.com/a/320657/649099