OneBitDeploy
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 database

On Apps, press Add app → Add database, choose MongoDB, give it a Name and press Create database. OneBit provisions the database and shows you the connection details on its page.

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