Skip to main content
Betadocs
DocsStatusSupportPricing
  • Introduction
    • Introduction to Webgune
    • How Webgune works
    • Creating an account
    • Creating your first project
    • Exploring the dashboard
  • Deployment

    • Deploying from GitHub
    • Deploying a Docker image
    • How builds work
    • Deployments and rollback
    • Environment variables
    • Custom start command
    • Health check
    • Database migrations

    Web apps

    • Web applications
      • Supported frameworks
      • Next.js
      • React / Vite
      • Node.js
      • Python
      • PHP
      • Go

    Bots & workers

    • Discord bots
    • Workers

    Docker

    • Docker
      • Writing a Dockerfile
      • Public Docker images

    Databases

    • Databases
      • PostgreSQL
      • MySQL
      • MariaDB
      • MongoDB
      • Redis

    Observability

    • Logs and monitoring
    • Web terminal

    Scaling

    • Availability and scaling
    • Persistent volumes
    • Backups and restore
    • Sleep mode

    Platform

    • One microVM per service
    • Network and isolation
    • Platform security
    • Deploying a template
      • Template catalog
    • Free subdomains
    • Custom domains
    • Buying a domain
    • Hosting DNS for a domain bought elsewhere
    • Managing your DNS records
    • SSL certificates
    • Redirects
    • Shared projects
      • Roles and permissions
    • Real-time collaboration
    • Continuous deployment
      • The kx712.yml file
    • VS Code extension
    • Plans and pricing
    • Payments and invoices
    • Account or per-project subscription
    • API reference
    • API keys
    • Webgune CLI
    • MCP server
    • JavaScript / TypeScript SDK
    • Support tickets
    • Status page
    • AI assistant
    • FAQ
    • Limits and resources
    • Account security
    • Best practices
    • Troubleshooting

Services / Databases

MongoDB

Open as Markdown

MongoDB is a document-oriented database, suited to schemas that change often or to nested data. On Webgune, MongoDB 7 exists only as a project database, a service in your project with its volume. There is no managed MongoDB.

Value
VersionMongoDB 7
Port27017
Userkxuser, unless you chose otherwise at creation. It is an administrator account, declared in the admin database
Storage5 GB volume
Resourcesat most 1 vCPU and 1 GB of memory, taken from your plan
Instancesone only, no replica set

Create a MongoDB database

  1. In the project, New service, then Deploy MongoDB.
  2. Fill in the Database name. The User is kxuser if the field is left empty, the Password is generated if the field is left empty (at least 8 characters otherwise).
  3. Click Create.

The service's Database tab shows the internal host, the port, the user, the masked password and the full connection string.

Connection string

MONGODB_URI=mongodb://kxuser:MOT_DE_PASSE@ma-db.kx-app-1a2b3c4d.svc.cluster.local:27017/ma-db?authSource=admin

?authSource=admin is required: the account is declared in the admin database, not in your database. Without this parameter, the connection fails with Authentication failed.

The internal address answers only the services of the same project (Network and isolation).

Mongoose (Node.js)

import mongoose from "mongoose";

await mongoose.connect(process.env.MONGODB_URI!, { maxPoolSize: 10 });

const PostSchema = new mongoose.Schema({
  title:     { type: String, required: true },
  content:   String,
  createdAt: { type: Date, default: Date.now, index: true },
});

export const Post = mongoose.model("Post", PostSchema);

process.on("SIGTERM", async () => {
  await mongoose.disconnect();
  process.exit(0);
});

PyMongo (Python)

import os
from pymongo import MongoClient

client = MongoClient(os.environ["MONGODB_URI"], maxPoolSize=10)
db = client.get_default_database()   # the database named in the URI
posts = db.posts.find({"published": True})

Indexes

MongoDB indexes only _id by default. A query on a non-indexed field scans the whole collection, which shows from a few thousand documents and uses the memory limited to 1 GB.

await Post.collection.createIndex({ createdAt: -1 });

In production, turn off Mongoose's automatic index creation (autoIndex: false) and create the indexes once, at deployment.

Access from your machine

Turn on Public access in the Database tab. The panel shows a Public host and a Public port, different from 27017.

mongosh "mongodb://kxuser:MOT_DE_PASSE@HOTE_PUBLIC:PORT_PUBLIC/ma-db?authSource=admin"

MongoDB Compass accepts the same string. The public port is open to the whole Internet, with no address list: only the password protects the database. Turn the access off after the intervention.

Queries from the panel

The console in the Database tab runs the command with mongosh --eval and stops it after 30 seconds. It suggests db.stats() by default. Examples:

db.getCollectionNames()
db.posts.find({ published: true }).limit(5).toArray()
db.posts.countDocuments()

Backups

mongodump --uri "mongodb://kxuser:MOT_DE_PASSE@HOTE_PUBLIC:PORT_PUBLIC/ma-db?authSource=admin" --out ./sauvegarde
mongorestore --uri "mongodb://kxuser:MOT_DE_PASSE@HOTE_PUBLIC:PORT_PUBLIC/?authSource=admin" ./sauvegarde

The service's Backups tab also schedules volume snapshots (Backups and restore).

Limits to know

  • No replica set: multi-document transactions and change streams, which need one, are not available.
  • A single instance. During a restart or a server failure, the database is unavailable.
  • The Move to a managed database button does not exist for MongoDB.

Common errors

MessageCauseWhat to do
Authentication failedauthSource=admin missing, or wrong passwordcopy the string from the Database tab again
Transaction numbers are only allowed on a replica set membertransaction or causal session requestedremove the transaction, or write related documents in a single operation
getaddrinfo ENOTFOUNDinternal address used outside the projectturn on Public access
Stop with code 137the database exceeds 1 GB of memoryadd the missing indexes, reduce unbounded queries

Updated on November 20, 2026

MariaDBPreviousRedisNext

On this page

Create a MongoDB databaseConnection stringMongoose (Node.js)PyMongo (Python)IndexesAccess from your machineQueries from the panelBackupsLimits to knowCommon errors
© 2026 WebguneBack to the site