Não há nenhum comando de serviço no OS X. Ele provavelmente está sendo gerenciado pelo launchd, o que significa que você precisará fazer o seguinte ( encontrado no Stack Overflow ). Note que existem 2 respostas abaixo, uma se você instalou usando a opção de casa, a outra não.
It's probably because launchctl is managing your mongod instance. If you want to start and shutdown mongod instance, unload that first:
launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
Then start mongod manually:
mongod -f path/to/mongod.conf --fork
You can find your mongod.conf location from
~/Library/LaunchAgents/org.mongodb.mongod.plist
.After that,
db.shutdownServer()
would work just fine.Added Feb 22 2014:
If you have mongodb installed via homebrew, homebrew actually has a handy
brew services
command. To show current running services:
brew services list
To start mongodb:
brew services start mongodb
To stop mongodb if it's already running:
brew services stop mongodb