Encountering issues with the MongoDB module installation on Drupal 11.

Created on 5 February 2025, 5 months ago
Updated 10 February 2025, 5 months ago

Issue Summary:
Fatal Error: A Fatal error occurs in the mongodb module, specifically in the StringDatabaseStorage.php file. The error message indicates that the method joinCondition() is being called on an object of class Drupal\pgsql\Driver\Database\pgsql\Select, but this method is not defined for the pgsql database driver.

Error Details:

Error Type: Uncaught Error: Call to undefined method Drupal\pgsql\Driver\Database\pgsql\Select::joinCondition()
File: /web/modules/contrib/mongodb/src/modules/locale/StringDatabaseStorage.php
Line: 209
Stack Trace: The error is triggered when attempting to execute a database query related to locale translation and string storage, specifically during cache lookup and menu link management.
Steps to Reproduce:
Install or enable the mongodb module.
Run a drush cr (cache rebuild) or visit the site.
Encounter the fatal error.
Expected Behavior:
The method joinCondition() should be defined or an alternative approach should be used for the pgsql driver.
The site should function without fatal errors, particularly in areas related to locale and menu link management.
Possible Cause:
It appears the mongodb module is attempting to execute a query that is intended for another database driver (likely MySQL or MariaDB) but is being executed on a PostgreSQL (pgsql) database. This mismatch results in the call to the undefined method joinCondition(), which is not available in the PostgreSQL database API.

Full Error log

PHP Fatal error: Uncaught Error: Call to undefined method Drupal\pgsql\Driver\Database\pgsql\Select::joinCondition() in /var/www/php8/drupall11/web/modules/contrib/mongodb/src/modules/locale/StringDatabaseStorage.php:209
Stack trace:
#0 /var/www/php8/drupall11/web/modules/contrib/mongodb/src/modules/locale/StringDatabaseStorage.php(48): Drupal\mongodb\modules\locale\StringDatabaseStorage->dbStringSelect()
#1 /var/www/php8/drupall11/web/core/modules/locale/src/LocaleLookup.php(141): Drupal\mongodb\modules\locale\StringDatabaseStorage->findTranslation()
#2 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Cache/CacheCollector.php(148): Drupal\locale\LocaleLookup->resolveCacheMiss()
#3 /var/www/php8/drupall11/web/core/modules/locale/src/LocaleTranslation.php(121): Drupal\Core\Cache\CacheCollector->get()
#4 /var/www/php8/drupall11/web/core/lib/Drupal/Core/StringTranslation/TranslationManager.php(92): Drupal\locale\LocaleTranslation->getStringTranslation()
#5 /var/www/php8/drupall11/web/core/lib/Drupal/Core/StringTranslation/TranslationManager.php(140): Drupal\Core\StringTranslation\TranslationManager->getStringTranslation()
#6 /var/www/php8/drupall11/web/core/lib/Drupal/Core/StringTranslation/TranslationManager.php(112): Drupal\Core\StringTranslation\TranslationManager->doTranslate()
#7 /var/www/php8/drupall11/web/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(190): Drupal\Core\StringTranslation\TranslationManager->translateString()
#8 /var/www/php8/drupall11/web/core/lib/Drupal/Component/Utility/ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
#9 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/EntityType.php(718): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
#10 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(1408): Drupal\Core\Entity\EntityType->getBundleLabel()
#11 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/EditorialContentEntityBase.php(20): Drupal\Core\Entity\ContentEntityBase::baseFieldDefinitions()
#12 /var/www/php8/drupall11/web/core/modules/menu_link_content/src/Entity/MenuLinkContent.php(277): Drupal\Core\Entity\EditorialContentEntityBase::baseFieldDefinitions()
#13 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php(230): Drupal\menu_link_content\Entity\MenuLinkContent::baseFieldDefinitions()
#14 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php(195): Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions()
#15 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php(454): Drupal\Core\Entity\EntityFieldManager->getBaseFieldDefinitions()
#16 /var/www/php8/drupall11/web/modules/contrib/mongodb/src/EntityQuery/Condition.php(83): Drupal\Core\Entity\EntityFieldManager->getFieldStorageDefinitions()
#17 /var/www/php8/drupall11/web/modules/contrib/mongodb/src/EntityQuery/Condition.php(51): Drupal\mongodb\EntityQuery\Condition->addConditions()
#18 /var/www/php8/drupall11/web/modules/contrib/mongodb/src/EntityQuery/Query.php(143): Drupal\mongodb\EntityQuery\Condition->compile()
#19 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(82): Drupal\mongodb\EntityQuery\Query->compile()
#20 /var/www/php8/drupall11/web/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php(64): Drupal\Core\Entity\Query\Sql\Query->execute()
#21 /var/www/php8/drupall11/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(101): Drupal\menu_link_content\Plugin\Deriver\MenuLinkContentDeriver->getDerivativeDefinitions()
#22 /var/www/php8/drupall11/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives()
#23 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Menu/MenuLinkManager.php(125): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#24 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Menu/MenuLinkManager.php(150): Drupal\Core\Menu\MenuLinkManager->getDefinitions()
#25 /var/www/php8/drupall11/web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(62): Drupal\Core\Menu\MenuLinkManager->rebuild()
#26 /var/www/php8/drupall11/web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(50): Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->menuLinksRebuild()
#27 /var/www/php8/drupall11/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->onRouterRebuild()
#28 /var/www/php8/drupall11/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
#29 /var/www/php8/drupall11/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#30 /var/www/php8/drupall11/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(197): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#31 /var/www/php8/drupall11/web/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild()
#32 /var/www/php8/drupall11/web/core/includes/common.inc(454): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()
#33 /var/www/php8/drupall11/web/core/includes/utility.inc(41): drupal_flush_all_caches()
#34 /var/www/php8/drupall11/vendor/drush/drush/src/Commands/core/CacheRebuildCommands.php(60): drupal_rebuild()
#35 [internal function]: Drush\Commands\core\CacheRebuildCommands->rebuild()
#36 /var/www/php8/drupall11/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#37 /var/www/php8/drupall11/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#38 /var/www/php8/drupall11/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#39 /var/www/php8/drupall11/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#40 /var/www/php8/drupall11/vendor/symfony/console/Command/Command.php(279): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#41 /var/www/php8/drupall11/vendor/symfony/console/Application.php(1094): Symfony\Component\Console\Command\Command->run()
#42 /var/www/php8/drupall11/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand()
#43 /var/www/php8/drupall11/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRun()
#44 /var/www/php8/drupall11/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#45 /var/www/php8/drupall11/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#46 /var/www/php8/drupall11/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
#47 /var/www/php8/drupall11/vendor/bin/drush.php(119): include('...')
#48 {main}
thrown in /var/www/php8/drupall11/web/modules/contrib/mongodb/src/modules/locale/StringDatabaseStorage.php on line 209
[warning] Drush command terminated abnormally.

Note* site will down after that
💬 Support request
Status

Active

Version

3.1

Component

Base module (driver)

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Postponed: needs info 5 months ago
  • 🇳🇱Netherlands daffie

    @faheemakhtar, Could you tell me which version of Drupal you are using? The module currently only supports Drupal 11.1. My second question is: did you follow the instructions in the readme file? Did you apply the Drupal core patch? Without it it does not work.

    BTW Thank you for trying out this module. The easiest way to reach me is on Drupal Slack.

  • 🇮🇳India shashank5563 New Delhi

    I am trying to install mongodb 3.1 in my current Drupal 11.6 project.
    Current project is running with mysql db. I want integrate mongodb 3.1 module as well.
    After installing module getting following error.

    PHP Fatal error: Uncaught Error: Call to undefined method Drupal\mysql\Driver\Database\mysql\Connection::getConnection() in /var/www/html/web/modules/contrib/mongodb/src/Driver/Database/mongodb/TableInformation.php:70

  • 🇮🇳India shashank5563 New Delhi

    #daffie,
    Mongodb : 3.1
    Drupal : 11.6

    Existing project

    Issue Summary:

    The MongoDB 3.1 module currently assumes that MongoDB will act as the primary database. This design leads to conflicts when trying to integrate it into a Drupal project that already uses MySQL (or any SQL-based system) — especially when upgrading from Drupal 10 to 11.

    ---

    Problem Points You Noticed:

    Module doesn't provide an option to use MongoDB alongside MySQL (hybrid setup).

    Upgrading Drupal 10 to 11 forces you to recreate the site just to change DB.

    Ability to register MongoDB as a secondary database in settings.php.

    What You Can Do Right Now:

    Provide hybrid DB support documentation.

    Allow MongoDB to be added as a secondary connection, not primary.

    Update README to clarify that it is not drop-in compatible with Existing project.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇫🇷France fgm Paris, France

    AIUI the goal of the v3 series of this module (at this point) is to have a completely No SQL fresh Drupal install.

    Compatibility with previous versions or a mix of SQL and NoSQL is not a current goal. It is, however, provided by the 2.x series which, as a consequence only provides a limited amount of dedicated MongoDB services instead of the whole CMS like 3.x does.

  • 🇮🇳India shashank5563 New Delhi

    @fmg, 2.x series is not compatible with Drupal-11.

    So, please make it Drupal-11 compatible.

Production build 0.71.5 2024