Skip to main content

MongoDB Connections

TablePro supports MongoDB 5.0 and later. Collections appear as tables in the sidebar. Documents display with fields as columns, and nested objects render as formatted JSON.

Quick Setup

1

Create Connection

Click New Connection, select MongoDB, enter host/port/username/password/database, and click Create
2

Test Connection

Click Test Connection to verify

Connection Settings

FieldDefaultNotes
Hostlocalhost
Port27017
Database-Database name to connect to
Username-Leave empty for local dev without auth
Password-
Auth DatabaseadminDatabase to authenticate against
Advanced (Optional): Configure Read Preference (primary, secondary, nearest) and Write Concern (majority for stronger durability) for replica sets.
MongoDB connection form

Example Configurations

Local: host localhost:27017, no auth, database myapp Docker: host localhost:27017 (or mapped port), password from MONGO_INITDB_ROOT_PASSWORD env, auth DB admin MongoDB Atlas: Enable SSL/TLS in connection form Remote: Use SSH tunneling for secure access

SSL/TLS

Configure in SSL/TLS section. MongoDB Atlas requires SSL/TLS - use Required or Verify CA. For unencrypted alternatives, use SSH tunneling.

Features

Collection Browsing: Sidebar shows all collections. Click to view documents in data grid. Document Viewing: Top-level fields as columns, nested objects as formatted JSON, arrays as JSON arrays, ObjectIds as strings, BSON types formatted appropriately. Schema inferred by sampling. Collection Duplication: Open Create Table, click Duplicate, select source collection. Uses aggregate with $out, recreates indexes. Result named originalName_copy. MongoDB Shell Queries (MQL syntax):
// Find documents with filtering
db.users.find({ age: { $gte: 18 }, active: true })

// Find with projection and sorting
db.orders.find(
  { status: "completed" },
  { customerId: 1, total: 1, date: 1 }
).sort({ date: -1 }).limit(20)

// Aggregation pipeline
db.sales.aggregate([
  { $match: { date: { $gte: ISODate("2025-01-01") } } },
  { $group: { _id: "$product", totalSales: { $sum: "$amount" } } },
  { $sort: { totalSales: -1 } },
  { $limit: 10 }
])

// Count documents
db.users.countDocuments({ role: "admin" })

// Distinct values
db.products.distinct("category")
CRUD: Insert with insertOne()/insertMany(), update with updateOne()/updateMany(), delete with deleteOne()/deleteMany().

Troubleshooting

Connection refused: Check MongoDB is running (brew services start mongodb-community), verify host/port in mongod.conf, check bindIp setting. Auth failed: Verify username/password/auth database. Check user roles with db.getUsers(); Create user with db.createUser({user:"appuser", pwd:"password", roles:[{role:"readWrite", db:"myapp"}]}) Timeout: Verify host/port, check network and firewall, whitelist IP in MongoDB Atlas. Limitations: Transactions need replica set/sharded cluster, schema inferred by sampling, capped collections restricted, GridFS not browsable, change streams unsupported. Performance: Use filters, limit(), pagination, indexes. Analyze with explain("executionStats").