•  MongoDB is schema free document oriented database.
  • The basic unit of storage is JSON, Python dictionaries, Ruby hashes, etc.
  • MongoDB is a high performance NoSQL database that is significantly faster than mysql for reads and writes.


Druapl & MongoDB:

In the current architecture of drupal, It is not possible to run purely in MongoDB. But the majority functionality of drupal is available in MongoDB backed. Major functionality those are supported in MongoDB are given below:


  •  Fields

The Field API allows custom data fields to be attached to Drupal entities and takes care of storing, loading, editing, and rendering field data. Any entity type (node, user, etc.) can use the Field API to make itself "fieldable" and thus allow fields to be attached to it. Other modules can provide a user interface for managing custom fields via a web browser as well as a wide and flexible variety of data type, form element, and display format capabilities.


  •  Blocks

Blocks are made available to your site most commonly by enabling modules. Once created, a Block can be modified to adjust its appearance, shape, size and position - or which Website pages it appears on.


  • Watchdog

The watchdog module monitors your system and records system events in a log you can review. This helps you get a quick overview of activity on your site. Since the log records events in sequence, it can also be useful for debugging site errors.


  • Cache

If enables, page caching will only be used for anonymous users.If you enable page caching, the entire HTML of each page will be stored in the database. This significantly reduces the amount of queries needed.This automatically means that blocks will also get cached, disregarded their own cache settings.


  • Sessions

The sessions table keeps track of user sessions on your site. This table should have an entry for every user that's logged in to your site. Some users may even have more than one session entry if they're logged in from different devices or even different browsers.



Installing MongoDB


apt-get install mongodb-10gen or yum install mongodb

Installing the MongoDB PHP driver

Using Pecl to install the driver
pecl install mongo

Configuring PHP to use the driver

Integrating MongoDB and Drupal7

Installing the Drupal MongoDB module

Configure Drupal to use the MongoDB

Adding following lines in settings.php
Path will be according to your module installation path.

# -- Configure Cache
$conf['cache_backends'][] = 'sites/all/modules/contrib/mongodb/mongodb_cache/';
$conf['cache_class_cache'] = 'DrupalMongoDBCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalMongoDBCache';
$conf['cache_default_class'] = 'DrupalMongoDBCache';
# -- Don't touch SQL if in Cache
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
# Session Caching
$conf['session_inc'] = 'sites/all/modules/contrib/mongodb/mongodb_session/';
$conf['cache_session'] = 'DrupalMongoDBCache';
# Field Storage
$conf['field_storage_default'] = 'mongodb_field_storage';
# Message Queue $conf['queue_default_class'] = 'MongoDBQueue';

Enabling the MongoDB Module


Add new comment