OneBit Deploy
Databases

MongoDB

Provision and connect to a managed MongoDB database on OneBit Deploy.

MongoDB is a document database that stores flexible, JSON-like documents — useful when your data doesn't fit neatly into tables.

Create the database

Go to New → Managed database, choose MongoDB, name it and deploy. OneBit provisions the database and shows you the connection details.

Create a managed database

Connection string

A MongoDB connection string looks like this:

mongodb://USER:PASSWORD@HOST:PORT/DATABASE

Copy it into your app as a secret environment variable.

Connecting from Node.js

import { MongoClient } from 'mongodb';

const client = new MongoClient(process.env.DATABASE_URL);
await client.connect();
const db = client.db();
console.log(await db.command({ ping: 1 }));

Store the connection string as a secret environment variable, not in your code.

On this page