mongodbmacosinstallationosx-yosemite

How to check if mongo db is running on Mac?


I had installed MongoDB few days back on my Mac and am not sure how I installed, but now how do I check if MongoDB is up and running in my system?


Solution

  • Quick Solution

    Run the following in your Terminal:

    ps -ef | grep mongod | grep -v grep | wc -l | tr -d ' '
    

    This will get you the number of MongoDB processes running, thus if it is other than 0, then you have MongoDB running on your system.

    Step-by-Step

    As a result you will get a single number, representing the number of processes you grep'ed for.