MongoDB with DBine
How to connect DBine to MongoDB and what you can do once it's connected. This page is written from what the MongoDB driver says about itself, so it matches the version of DBine you download.
Connect
- In DBine, open New connection.
- Pick MongoDB in the list of engines.
- Fill in the fields below, press Test connection and then Save.
Default port: 27017.
General
| Field | Description |
|---|---|
| Server | Several members separated by commas: host1:27017,host2:27017. Example: localhost |
| Port | |
| Database | Initial database; empty = the one in the connection string or “test”. |
| Authentication | Kerberos uses the session's ticket (on macOS and Linux, the one from kinit user@REALM) and requires MongoDB Enterprise. Options: Username and password, Kerberos (GSSAPI) Default: Username and password |
| User | With Kerberos, the principal (user@REALM). |
| Password | Kept in the system keychain, never in DBine's files. Only with Authentication: Username and password. |
| Connection string | If filled in, it replaces the other fields. It also works for Azure Cosmos DB (MongoDB API) and MongoDB Atlas. Example: mongodb+srv://user:password@cluster.example.net/dbKept in the system keychain, never in DBine's files. |
| Read-only | On or off. |
SSH tunnel. The connection can go through an SSH server, even through a chain of bastions, with a password, a private key or the SSH agent. The server's fingerprint is checked against known_hosts or confirmed the first time.
SSL/TLS
| Field | Description |
|---|---|
| Encrypt the connection (TLS) | On or off. |
| Trust the server certificate | On or off. |
Advanced
| Field | Description |
|---|---|
| Authentication database | Example: adminOnly with Authentication: Username and password. |
| Kerberos service | The name of the service the server is registered under; almost always «mongodb». Example: mongodbOnly with Authentication: Kerberos (GSSAPI). |
| Replica set | Replica set name; empty = direct connection to the server. |
What the explorer shows
Under the connection: Databases. Inside each one:
- Collections
- Views
Query editor
The editor uses MongoDB's own query syntax, in JSON, with completion for the connection's objects. Statements and commands run against the database selected in the tab.
What the editor accepts:
mongosh-like syntax, one statement per line or separated with `;`:
db.collection.find({ age: { $gt: 30 } }, { name: 1 }).sort({ age: -1 }).limit(10)
db.collection.aggregate([{ $group: { _id: "$city", n: { $sum: 1 } } }])
db.collection.countDocuments({}) · db.collection.distinct("field", {})
db.collection.insertOne({…}) · updateMany(filter, { $set: {…} }) · deleteOne(filter)
db.getCollectionNames() · db.runCommand({ dbStats: 1 })
db.createCollection("c", { capped: true, size: 4096 }) · db.createView("v", "c", [{ $match: {} }])
db.getCollection("c").createIndex({ field: 1, date: -1 }, { unique: true }) · dropIndex("field_1") · db.dropDatabase()
DBine extension: db.createCollection("c", {…}, { ifNotExists: true }) does not fail if the collection already exists.
A raw JSON command is also accepted: { "find": "collection", "filter": {} }.
Unquoted keys, single quotes, ObjectId("…"), ISODate("…"), NumberLong(…) and /regex/i.
Ready-made templates for new objects:
- New view
- New time series
- New capped collection
- Change validator ($jsonSchema)
- New index
Tools for MongoDB
Available
- Graphical execution plans
- Live query profiler
- Server monitor
- Sessions and running queries
- End a session
- Locks: who blocks whom
- Cancel another session's query from the sessions list
- Index usage
- Create databases
- Drop databases
- Database properties
- Visual designer for new objects
- Rename objects
- Compare and sync schemas
- Native bulk load when migrating data
- Users and permissions
Not available for MongoDB
- Manual transactions (commit and rollback)
- Relations in the ER diagram
- Clone tables
- Backups
Why a tool doesn't apply to an engine, and the details of each one, are in the engine support reference.
Generated from the MongoDB driver 0.1.12, which DBine downloads the first time you connect to MongoDB.