Where is Mongoimport installed on Mac OS X
I am trying to set up a cronjob to import json data into a mongo database regularly. To do the import, I have the following command in a Python script that a cronjob starts:
os.system("mongoimport --jsonArray --db %s --collection %s --file .../data.txt" %(db_name,collection_name))
However, the cronjob log file keeps showing the following error:
sh: mongoimport: command not found
I think I need to call mongoimport with a full file path in code, but I'm not sure where mongodb / mongod / mongoimport is installed on my system. whereis mongoimport, whereis mongodb, whereis mongod all return nothing.
I have installed mongodb with Homebrew. The packages installed with Homebrew are located in / Library / Caches / Homebrew. However, on my system, there is only a tar file mongodb-2.6.4_1 in this folder. Do I have to unpack this tar file to access mongoimport?
Thank you for your help.
source to share
You have the same problem but I installed mongodb via Mac Port. Unfortunately, since version 3 of mongodb, these mongodb tools are supported as a separate project, so I updated the Mac port to the latest version and then installed the mongo tools separately.
sudo port install mongo-tools
Hope this helps someone who installs mongodb via mac port.
source to share