Documentation for macOS
#Installing MongoDB via Herd Pro
You can install the MongoDB Community Edition from the service management section of the settings. This uses the MongoDB PHP extension and allows a seamless use of MongoDB in your application during development.
#Configuration
Herd starts your MongoDB instance with sensible defaults that work great for new setups, and you can change the port of the service to run it in parallel to existing installations on your machine.
If you want to modify the settings of the service, you can right-click on the service in the settings and open its data directory. In this data directory, there is a mongodb.conf
that this MongoDB instance loads on startup.
Make sure to restart the service if you make changes to this configuration.
#Creating databases
You can create databases in your MongoDB instance by using the tooling that you can download on the official website or use tools like TablePlus that work with a variety of database engines.
#Connecting from your Laravel application
In order to use MongoDB in combination with Laravel, you may use the mongodb/laravel-mongodb
composer package.
Run the following command to add the dependency to your application:
composer require mongodb/laravel-mongodb
To connect your application to the database server, you can use the credentials that are listed next to the running service in the settings, or you can use the ones below.
Add these settings to your .env
file.
DB_CONNECTION=mongodbDB_PORT=27020DB_URI="mongodb://127.0.0.1:27020/laravel"
Please refer to the Laravel MongoDB documentation for additional help.
#Database service migrations
Whether you set up a newer version of MongoDB or migrate from existing instances on your machine, the most comfortable way is to use a database client like TablePlus to export and import the database tables.
#Versions
Herd Pro allows you to install the following versions directly from the services tab of the settings. New versions are available regularly.
Service | Version |
---|---|
MongoDB | 7.0.12 |