Drupal Mongodb - No database aliases found in settings. Did you actually configure your settings ?

Submitted by sysop on Wed, 09/13/2023 - 11:51

No database aliases found in settings. Did you actually configure your settings ?


MongoDB is a NoSQL database that can be used as an alternative to traditional relational databases like MySQL or PostgreSQL.The Drupal MongoDB module provides a way to store and retrieve data from MongoDB instead of using Drupal's default database backend. This can be useful for certain types of projects where a NoSQL database like MongoDB is a better fit for the data structure and requirements.

While configuring the mongodb drupal module, you might have noticed an error "No database aliases found in settings. Did you actually configure your settings ?" which arises due to the misconfiguration of the mongodb details.

In order to fix this above issue:

  1. Check if you have configured the mongodb database details properly in your settings.local.php file. Here is an example:
      $settings['mongodb'] = [
        'clients' => [
          // Client alias => connection constructor parameters.
          'mymongo' => [
            'uri' => 'mongodb://localhost:27017',
            'driverOptions' => [],
          ],
        ],
        'databases' => [
          // Database alias => [ client_alias, database_name ].
          'tutorial2' => ['mymongodb', 'mongodb_database_example'],
        ],
      ];
  2. Make sure you have have included the settings.local.php file in settings.php file. To include settings.local.php in your Drupal site, you typically add the following lines to your settings.php file near the end:
    if (file_exists(__DIR__ . '/settings.local.php')) {
      include __DIR__ . '/settings.local.php';
    }
  3. If you have not included your settings.local.php file in your settings.php file. You can include the mongodb details as in step1 to your settings.php file instead.
  4. Finally, if everything is configured properly, you must notice "Valid configuration" in MongoDB section.

    No database aliases found in settings. Did you actually configure your settings ?

Hope this helps!!!