Maslosoft Mangan Logo Maslosoft Mangan Documentation
MongoDB Object Persister

Edit

Configuration

Connecting to MongoDB

By default Mangan will connect to MongoDB on localhost, port 27017. This can be customized by setting property $connectionString.

Connection string must start with mongodb:// followed by server connection data in form of username:password@db-host:port, for example:

mongodb://root:admin123@example.com:27018

Only required connection string part is it's host. When other parameters are not specified, they will be substituted with default values:

  • Empty username
  • Empty password
  • 27017 port

Connecting to multiple servers

To connect Mangan to replica set separate multiple servers with coma:

mongodb://localhost,root:admin123@example.com:27018,user:123HHx@maslosoft.com

This is minimal configuration for replication.

Checking connection

To test if Mangan can connect to any of the servers, ping() command can be used, this will return array containing success or error message as an array:

['ok' => 1]

This result is equivalent of calling native MongoDB ping command.

Note that ping() will not check authentication, but will indicate whether it is possible to connect.

To check if user is properly authenticated, use any command that interacts with collection, for example collStats().