Database setup

Infrastructure Dependencies

DPS uses MongoDB to store settings. It also supports Azure CosmosDB with MongoDB compatibility. The following configuration options are available for setting up the MongoDB connection string and other database-related configurations:

# Specify the MongoDB connection string
ipf.mongodb.url = "mongodb://localhost:27017/dynamic-settings"

# Feature toggle for creating indexes automatically from HOCON config after the Spring context is initialized
ipf.dps.mongodb.create-indexes = true
ipf.dps.mongodb.create-indexes = ${?ipf.mongodb.create-indexes}

Mongo and Cosmos configuration

For connection to the Mongo database we need to set db mode in hocon configuration to mongo (default)

ipf.mongodb.database-mode = mongo

For connection to the Cosmos database we need to change db mode in hocon configuration to a value cosmosdb

ipf.mongodb.database-mode = cosmosdb

Index Creation

Depending on searchable fields for settings, we should create database indexes for better performance - DPS Index Creation

Database collections

DPS allows users to define database collection names for each setting type. However, there are two database collections used for approvals and history.

Comma separated values indicate a composite index
Collection Index Comment

settings-approvals

Used when a setting requires an approval.

settings-history

Used to track a history of the setting.