Tina Docs
Introduction
Core Concepts
Querying Content
Editing
Customizing Tina
Going To Production
Drafts
Guides
Further Reference
Table of Contents

The MongoDB database adapter allows you to store your data in a MongoDB database. This adapter uses the MongoDB Node.js Driver, so it will work on any MongoDB database.

Looking for the code? Check out the GitHub repository.

To get started you will need to add the following environment variables to your project:

MONGODB_URI=***

Create the database adapter

import { MongodbLevel } from 'mongodb-level'
//...
export default isLocal
? createLocalDatabase()
: createDatabase({
// ...
databaseAdapter: new MongodbLevel<string, Record<string, any>>({
// If you are not using branches you could pass a static collection name. ie: "tinacms"
collectionName: `tinacms-${branchName}`,
dbName: 'tinacms',
mongoUri: process.env.MONGODB_URI as string,
}),
})