Formula mongodb has been removed from homebrew-core.
Luckily, the team of mongodb is managing a custom Homebrew tap. You can just simply uninstall the former mongodb and reinstall the new one from the new tap.
brew services stop mongodb
brew uninstall mongodb
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
For more information regarding the same, refer the following link:
https://github.com/mongodb/homebrew-brew
Want to learn MongoDB from the experts, Check out this MongoDB Course in Sydney to enhance your Knowledge!