dbx/docs/content/docs/mongodb.mdx

77 lines
3.3 KiB
Plaintext

---
title: MongoDB Browser
description: Browse MongoDB databases and collections, view documents, and edit data with the built-in JSON editor.
---
DBX supports browsing and editing MongoDB databases with a document-oriented interface designed for MongoDB's flexible schema model.
## Collections Browser
MongoDB databases and collections appear in the sidebar alongside relational databases. The browser supports:
- Listing all databases on the server
- Listing collections within each database
- Paginated document browsing within collections
- Filter and sort support for document queries
- **Database and collection deletion**: Right-click on a database or collection to delete it
- **Collection metadata**: View collection statistics including document count, size, and indexes
<Callout type="info">MongoDB connections support both standard connection strings and legacy connection formats. For replica sets, use the standard `mongodb://` connection URL with the replica set name.</Callout>
## Switching Databases
Use the `use <database>` command in the MongoDB command runner to switch the active database. This is equivalent to the MongoDB shell's `use` command and updates the current database context for subsequent operations.
## Table View
Collections are displayed in a table view that flattens the document structure:
- Top-level fields appear as columns
- Nested fields are shown in dot notation (e.g., `address.city`)
- Missing fields across documents are handled gracefully
- Column widths auto-fit to content
## Document Viewer
Click any document to open it in the detail panel. The JSON viewer provides:
- Syntax-highlighted JSON display
- Collapsible nested objects and arrays
- Copy individual fields or the entire document
## Inline Editing
Edit documents directly from the table view:
- Double-click a cell to edit its value
- Changes are staged locally before saving
- Review the generated update command before applying
## JSON Editor
In document view, switch between field-tree editing and whole-document JSON editing:
- Edit or create a document as a full JSON object
- Validate the entire JSON payload before saving
- Paste complete documents when inserting new records
- Keep the field editor for targeted field changes
- **Whole-document replace on update**: saving JSON replaces the document body
- **Identity change**: editing `_id` inserts a document under the new id and deletes the previous one
- **Date and Extended JSON preservation**: `$date`, `$oid`, and `$numberLong` values are preserved correctly during edits
## MongoDB Versions
DBX supports MongoDB 4.2 and later through the built-in driver. For pre-4.2 MongoDB instances, DBX can fall back to the JDBC agent driver. See [Driver Management](/en/docs/driver-management) for details on configuring agent drivers.
## Feature Coverage
| Feature | Support |
| --------------------------------- | -------------------- |
| List databases and collections | All versions |
| Document browsing with pagination | All versions |
| Table view with flattened fields | All versions |
| Filter and sort | MongoDB 4.2+ |
| Inline editing | All versions |
| JSON document editor | All versions |
| SSH tunnel | Standard connections |