Installation and Administration

MongoDB

Updated: July 17, 2023

DBS (Document-Based Storage) is an infrastructure in the Nuxeo Platform allowing storage of documents inside a document-oriented store, like NoSQL.

The first implementation is available for MongoDB.

Nuxeo supports the following MongoDB versions:

2.8, 3.0, 3.2 (Since 7.10-HF07)

Installation

When using MongoDB 3.0 we recommand that you configure the WiredTiger storage engine for better performance of write operations. Please follow this documentation to activate this storage engine.

Nuxeo stores its information in the configured database, under the default collection. The name of the collection is the Nuxeo repository name.

By default MongoDB doesn't require authentication, you can enable the client access control and create a user with the dbAdmin role.

Users creation in versions 3.x and Nuxeo below LTS2015-HF07

If you are using a version 3.x of MongoDB, you have to change the authentication schema before creating the users in the database. In those versions, the default authentication mechanism is SCRAM-SHA-1 which is not supported by Nuxeo < LTS 2015 HF07 where the MongoDB driver only supports MONGO-CR.

Note that if you are upgrading from a 2.6 or 2.8 databases, you will be fine as the MONGO-CR credentials were previously created.

For a new MongoDB instance, use the following commands:

mongo
use admin
db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 })

For existing MongoDB instance with users, you need to remove the user first (make sure you don't need them before) then change the authentication schema using the following commands:

mongo
use admin
db.system.users.remove({})
db.system.version.remove({})
db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 })

Then restart the server and recreate users.

 

Configuration

To activate MongoDB document storage, add the mongodb template to your existing list of templates (nuxeo.templates) in nuxeo.conf.

You must keep the template corresponding to your SQL database in nuxeo.templates, because the SQL database may still be used for other things (directories, audit, etc.). For instance you could have:

nuxeo.templates=postgresql,mongodb

or

nuxeo.templates=default,mongodb

The following properties are available in nuxeo.conf:

  • nuxeo.mongodb.server: the MongoDB server, either a hostname or a hostname with port, or a full mongodb:// URI (defaults to localhost:27017).

    The MongoDB URI pattern is:  mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

  • nuxeo.mongodb.dbname: the MongoDB database (defaults to nuxeo).

Using the full mongodb:// URI syntax you can configure the connection options, like the pool size, the write concern or the read preference, for instance:

nuxeo.mongodb.server=mongodb://example1.com,example2.com,example3.com/?readPreference=secondary

See the Connection String URI Format for the list of options.

GridFS

In recent Nuxeo versions or when using the appropriate Nuxeo Package, it's possible to use MongoDB's GridFS mechanism to store binary files inside MongoDB instead of the default filesystem mechanism of Nuxeo. This is activated by adding gridfsbinaries to the templates, for instance:

nuxeo.templates=postgresql,mongodb,gridfsbinaries

When doing this, binaries will be stored in the default.fs GridFS bucket, which means that in native MongoDB the collections default.fs.files and default.fs.chunks will be used. See the GridFS Reference for more details about MongoDB's GridFS implementation.

 


Related pages in current documentation