Use your managed MongoDB database
MongoDB connection string, connect via Compass or a driver, create a user and backups.
Use your managed MongoDB database
Credentials and the full connection string are in the panel’s Database tab.
1. Connection string
Standard format:
mongodb://<user>:<password>@<host>:27017/<database>?authSource=admin
To enable TLS:
mongodb+srv://...?tls=true
Use the pre-generated string from the panel (it already includes the correct
authSourceand TLS).
2. Connect
MongoDB Compass (GUI)
Paste the connection string into New Connection → Paste connection string.
Official driver (Node.js)
import { MongoClient } from "mongodb"
const client = new MongoClient(process.env.MONGO_URL)
await client.connect()
const db = client.db("my_db")
mongosh (CLI)
mongosh "mongodb://<user>:<password>@<host>:27017/<database>?authSource=admin"
3. Allow your IP
Add your IP under Database → Allowed IPs. Otherwise the connection is refused.
4. Create an application user
db.createUser({
user: "app",
pwd: "password",
roles: [{ role: "readWrite", db: "my_db" }]
})
5. Backups
Automatic daily backups are managed by onesubnet. Manual export:
mongodump --uri="<connection_string>" --out=./dump
References
- MongoDB docs: https://www.mongodb.com/docs/manual/
- Connection string: https://www.mongodb.com/docs/manual/reference/connection-string/