mongodb_storage module implements the Key-Value storage
for Drupal in MongoDB.
To use the MongoDB Key-Value (Expirable) storage:
- ensure there is a
keyvaluedatabase alias as in settings configuration.
declare MongoDB as the default Key-Value storage implementation by editing the existing declarations in the
# In sites/default/services.yml. factory.keyvalue: default: keyvalue.mongodb factory.keyvalue.expirable: keyvalue_expirable_default: keyvalue.expirable.mongodb
enable the module, e.g. using
drush en mongodb_storage.
import the existing Key-Value contents from the database, using the Drush or Console
drush most-ikv. It will output the names of the imported stores, for your information:
rebuild the container to take these changes into account using
The module provides one single command to import the content of the default SQL storage for Key-Value into MongoDB. The command is available for Drush and Drupal Console indifferently, and is described in the previous paragraph as part of the configuration steps.