How to configure MongoDB with Wiki.js


MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.

MongoDB 3.2 or later is required.

It can safely be installed on the same server as Wiki.js. MongoDB is mainly used for users and content metadata, which is very light on server resources usage.

Replica Set / Sharded Cluster installations are fully supported.

Should you prefer on having a cloud provider host the MongoDB instance for you, here's a few examples:

Cloud Provider Considerations

Make sure the MongoDB instance runs in the same datacenter (preferrably) or the same region. Connecting to instances located in another location will result in latency and poor performances!

Connection String

A MongoDB connection string is formatted as such:
mongodb://[username:[email protected]]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

Refer to the official MongoDB documentation for all the possible options.

You can also use an environment variable containing the MongoDB connection string, e.g:


Using a local MongoDB instance (on the same server as Wiki.js):

A username/password protected instance on a single remote server:
mongodb://username:[email protected]:27017/wiki

A username/password protected instance on a remote cluster:
mongodb://username:[email protected]:27017,,