Change record status: 
Introduced in branch: 

Most contrib modules have no reason to talk to the database directly instead a combination of configuration management, key value storage and the entity system should be used. This change notice is for modules integrating Drupal with a database not supported by core and the users of these.


In order to swap out the storage of some specific service you could always change the container on compile() time.

class Example implements CompilerPassInterface {
  public function process(ContainerBuilder $container) {
    $container->set('lock', new Definition('Drupal\mongodb\lock\Lock'));


The service you want to replace has to be tagged with 'backend_overridable':

    class: Drupal\Core\Lock\DatabaseLockBackend
    arguments: ['@database']
      - { name: backend_overridable }

The default backend is the database driver: mysql, pgsql etc.

Aliases are

Will use MySQL (or whatever the relevant driver is) for everything except the configuration which will be stored in MongoDB.

For developers of such modules, pick first a backend value (for example, mongodb). Then it is possible to specify overrides for services tagged with backend_overridable and they will automatically be picked up if the user (or an install profile) sets the default_backend accordingly. So the service is called so because a) the module uses mongodb as the default_backend b) is tagged as backend_overridable.

Site builders, administrators, editors
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other updates done