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:
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
To activate MongoDB document and directories storage (as of after Nuxeo FT 9.2), add the
mongodb template to your existing list of templates (
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-directory templates in order to store respectively audit or directories data in MongoDB. For example:
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:
The following properties are available in
|Property name||Description||Default value|
||The MongoDB server, either a hostname or a hostname with port or a full
||The MongoDB database.||
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:
See the MongoDB Connection String URI Format for the list of options.
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.
Hotfixes and indexes
Since LTS 2021 (NXP-29261) indexes are defined in document schemas and created during Nuxeo start. This is fine when starting from scratch, but it is not recommended on existing instance with large amount of documents, because creating an index is an heavy operation that can timeout or impact the MongoDB performance.
Some hotfixes may add missing or needed indexes to improve the overall performances of the platform. By default, a nuxeo server restarting after having installed an Hotfix defining a new index will try to create these indexes if not existing.
On instances with large repository:
- It is recommended to create the new indexes defined by an Hotfix prior to restarting the server. Each Hotfixes Installation Notes provides the command in order to create manually any new indexes for this matter.
- The auto create index on start option could be disabled with the nuxeo conf property
nuxeo.db.indexes.create=falseas long as the Hotfixes Installation Notes are carefully reviewed in order to manually create the needed indexes.
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:
When doing this, binaries will be stored in the
default.fs GridFS bucket, which means that in native MongoDB the collections
default.fs.chunks will be used. See the GridFS Reference for more details about MongoDB's GridFS implementation.
Connection Pool Configuration
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
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: