Document-Based Storage is an architectural abstraction in the Nuxeo Platform that allows the storage of documents in a document-oriented store, for instance NoSQL databases.

An implementation is available for MongoDB.

Nuxeo supports the following MongoDB version:

MongoDB 3.4 and 4.2

Installation

When using MongoDB 3.2 or higher the WiredTiger storage engine is the default storage engine.
Please follow this documentation if you’re running on MongoDB 3.0 to activate this storage engine for better performance of write operations.

Nuxeo stores its data in a MongoDB database under the default collection. The name of the collection is the Nuxeo repository name. If you have more than one repository configured, other collections with the names of these repositories will be used for storage.

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

Nuxeo Configuration

To activate MongoDB document and directories storage (as of Nuxeo FT 9.2), add the mongodb template to your existing list of templates (nuxeo.templates) in nuxeo.conf. Including the mongodb-audit template that will also activate audit storage.

For versions of Nuxeo released previously to Nuxeo FT 9.2, if you want to activate audit and directories storage, you need to install the MongoDB extension addon. This addon includes mongodb-audit and mongodb-directory templates in order to store respectively audit or directories data in MongoDB. For example:

nuxeo.templates=default,mongodb,mongodb-audit

If you are not using the MongoDB extension addon for previous versions of Nuxeo, you must keep the template corresponding to your SQL database in nuxeo.templates. 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 if you have an authentication, the pattern is: mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] (defaults to localhost:27017)
  • 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/?maxPoolSize=200

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

TLS/SSL Configuration

If you have chosen to configure TLS/SSL then you can set up Nuxeo using nuxeo.conf with the following properties:

nuxeo.mongodb.ssl=true
nuxeo.mongodb.truststore.path
nuxeo.mongodb.truststore.password
nuxeo.mongodb.truststore.type
nuxeo.mongodb.keystore.path
nuxeo.mongodb.keystore.password
nuxeo.mongodb.keystore.type

See the Trust Store and Key Store Configuration page for more.

GridFS

It is 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=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.

Connection Pool Configuration

Nuxeo has MongoDBConnectionService to instantiate MongoDB connections in the platform. This service holds all connections to MongoDB. By default, a contribution with id default will be contributed to the Nuxeo Platform, filled with nuxeo.mongodb.server and nuxeo.mongodb.dbname from nuxeo.conf.

If the service doesn't have a registered connection for the given id, it will return the default one.

You can customize the connections used depending on the feature. To do so, you need to contribute a connection to the service as below:

<component name="[COMPONENT_NAME]">

  <extension target="org.nuxeo.runtime.mongodb.MongoDBComponent" point="connection">
    <connection id="[CONNECTION_ID]">
      <server>mongodb://...</server>
      <dbname>...</dbname>
    </connection>
  </extension>

</component>

Here's a list of how features resolve their connection:

Feature Connection id
Audit audit
Directory directory/[DIRECTORY_NAME]
Repository repository/[REPOSITORY_NAME]
GridFS blobProvider/[BLOB_PROVIDER_ID]

Related pages in current documentation