Skip to main content

MongoDB Connections

Collections appear as tables in the sidebar. Documents display with top-level fields as columns and nested objects as formatted JSON. MongoDB is a registry plugin: it auto-installs when you create a MongoDB connection, or install it from Settings > Plugins > Browse > MongoDB Driver.

Quick Setup

1

Create Connection

Click New Connection, select MongoDB, enter hosts and credentials, and click Create
2

Test Connection

Click Test Connection to verify

Connection Settings

Advanced: Auth Database (usually admin), Read Preference, Write Concern, Use SRV Record, and Replica Set name.
MongoDB connection form with the multi-host Hosts editor

MongoDB connection form

MongoDB Atlas (SRV)

The Use SRV Record toggle in Advanced connects with the mongodb+srv:// scheme. For hosts ending in .mongodb.net, TablePro enables SRV automatically and turns TLS on if the SSL mode is Disabled, since Atlas requires both. An Atlas connection needs only the cluster hostname, username, and password.

Replica Sets

The Hosts field accepts multiple host:port pairs separated by commas (for example host1:27017,host2:27017,host3:27017). TablePro discovers the primary automatically and routes writes there. Set the replica set name in Advanced. You can also paste a multi-host URI directly:
SSH tunneling only forwards the first host. Other members must be reachable from the SSH server.

SSL/TLS

The MongoDB driver has no TLS fallback. Preferred behaves the same as Required (the SSL pane shows a warning). For unencrypted local instances, use Disabled or SSH tunneling. See SSL/TLS for details.

Connection URL

The mongodb+srv:// scheme resolves hosts through DNS SRV records and does not allow a port. If you paste an SRV URL that includes one (for example cluster.mongodb.net:27017), TablePro strips it before connecting. The plain mongodb:// scheme keeps any port you provide. See Connection URL Reference for all parameters.

Features

Collection Browsing: Sidebar shows all collections. Click to view documents in the data grid. Top-level fields render as columns, nested objects and arrays as formatted JSON, ObjectIds as strings. The grid schema is inferred by sampling documents. Views: New View in the sidebar opens a query tab with a db.createView("view_name", "source_collection", [pipeline]) template. Editing a view definition pre-fills a db.runCommand({"collMod": ...}) command. Explain: Press Cmd+Option+E on an MQL statement. TablePro converts find, aggregate, countDocuments, update, delete, and findOneAnd* calls into db.runCommand({"explain": ..., "verbosity": "executionStats"}). MQL Shell Queries:
Filters and pipelines are parsed as JSON/Extended JSON, not JavaScript. mongosh helpers like ISODate("2025-01-01") fail to parse; write {"$date": "2025-01-01T00:00:00Z"} instead. Supported methods: collection-level find, findOne, aggregate, countDocuments/count, insertOne/insertMany, updateOne/updateMany, replaceOne, deleteOne/deleteMany, findOneAndUpdate/findOneAndReplace/findOneAndDelete, createIndex, dropIndex, drop; database-level getCollectionNames/listCollections, createCollection, dropDatabase, version, stats. Anything else goes through db.runCommand({...}) or db.adminCommand({...}). Unlisted shell methods (for example distinct or getUsers) return an unsupported-method error.

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, and auth mechanism. The MQL editor does not parse db.getUsers() or db.createUser(); inspect users with db.runCommand({"usersInfo": 1}) or manage them in mongosh. Timeout: Verify host/port, check network and firewall, whitelist your IP in MongoDB Atlas. Limitations: Transactions are not exposed (statements always run standalone, on any topology), schema is inferred by sampling, GridFS is not browsable, change streams are unsupported.