mongodb – how to run mongo export on macbook?

I am using mongodb Atlas (M0), which does not provide db backup feature. I am creating a nodejs script that will export all the collections automatically periodically.

So far I have done the following:

  • created a programmatic api from my login.
  • whitelisted my ip
  • installed mongocli
  • created a default profile using public and private api keys.

And command looks like this:

mongoexport --uri mongodb+srv://${mongoUser}:${mongoPass}@punjabpolice.lok0l.mongodb.net/${database} --collection ${collection} --type ${fileType} --out ${fileName} --profile default

I am not able to figure out how to run this command. If I run this command in my terminal I get this error:
/bin/sh: mongoexport: command not foundn