mongodb run as daemon code example
Example 1: how to start mongod process in the background
mongod --fork --logpath /var/log/mongod.log
Example 2: run MongoDB manually as a background process macos
mongod --config /usr/local/etc/mongod.conf --fork