文档/MongoDB
此页面尚未翻译,当前显示英文版本。 查看英文版本
MongoDB
Document database for modern applications.
At a glance
- Category — Document
- Query language — MongoDB query syntax
- Default port — 27017
- URI scheme —
mongodb
MongoDB document driver for DBFlux.
Features
- Document driver classified as
DatabaseCategory::Documentwith theMongoQueryquery language; the editor uses MongoDB shell syntax, not SQL. - Connection modes: manual (host/port/credentials/database) and URI mode. URI mode accepts
mongodb://andmongodb+srv://connection strings (SRV records are parsed for replica-set discovery). - Multiple logical databases (
MULTIPLE_DATABASES) with collection browsing and document counting. - Authentication (
AUTHENTICATION) and TLS/SSL with three modes (off,on,verify), supporting a root certificate and optional client certificate. - SSH tunnel support for reaching MongoDB through a bastion host.
- Shell-style query parsing for
db.collection.method(...)anddb.method(...)forms, with a JSON-document fallback for backward compatibility. Supported methods:find,findOne,aggregate,count/countDocuments,insertOne,insertMany,updateOne,updateMany,deleteOne,deleteMany. Parse errors carry byte-offset positions for editor diagnostics. - Aggregation pipelines (
AGGREGATION); query capabilities advertise order-by, group-by, having, limit, and offset. - WHERE operators:
Eq,Ne,Gt,Gte,Lt,Lte,In,NotIn, and the logicalAnd/Or/Not. - Pagination via cursor and page-token styles (
PaginationStyle::Cursor,PaginationStyle::PageToken). - Document-focused schema metadata: collection fields and indexes (
INDEXES), with nested documents and arrays mapped into the document-tree view (NESTED_DOCUMENTS,ARRAYS). - Mutations: insert, update (including upsert), and delete (
supports_upsert: true). TheMongoShellGeneratoremitsinsertOne/insertMany,updateOne/updateMany(with{ upsert: true }), anddeleteOne/deleteManyfor previews and copy-as-query. - DDL: drop database, drop collection, create index, and drop index.
- JSON export of results (
EXPORT_JSON). - Reports client identity as
appName=dbflux/<version>on connect (visible in server logs anddb.currentOp()), unless the connection URI already sets anappName.
Instance Metrics
Exposes a curated set of live server metrics sourced from the MongoDB serverStatus command. Metrics are extracted via BSON dotted-path traversal:
mongo.connections_current— current open connectionsmongo.connections_available— available connection slotsmongo.opcounters_insert— insert operations since startupmongo.opcounters_query— query operations since startupmongo.opcounters_update— update operations since startupmongo.opcounters_delete— delete operations since startupmongo.opcounters_getmore— getMore operations since startupmongo.mem_resident— resident memory in MBmongo.mem_virtual— virtual memory in MBmongo.network_bytes_in— bytes received since startup
Each metric is returned as a single (timestamp_ms, value) row for live charting.
Instance Inspector
Exposes tabular snapshots of running server state:
mongo.current_op— in-progress operations from$currentOpaggregation pipeline (opid, type, ns, op, secs_running, wait_for_lock)
Limitations
-
SQL is not supported; queries must use MongoDB shell-style syntax (or the JSON fallback).
-
Instance metrics return a single data point per call (current snapshot from
serverStatus), not a historical time series. Operations counters (e.g.mongo.opcounters_insert) grow monotonically — interpret them as deltas between samples rather than absolute rates. -
$currentOprequires theinprogprivilege orclusterMonitorrole on Atlas clusters. Without sufficient privileges,fetch_inspector_snapshot("mongo.current_op")returns an empty result set. -
Query cancellation is not supported (
QUERY_CANCELLATIONis not set). -
RETURNINGis not supported; mutation capabilities also report no batch, no bulk update, and no bulk delete at the capability level (supports_batch,supports_bulk_update,supports_bulk_deleteare allfalse), even though the generator can emitupdateMany/deleteManytext. -
Parser coverage is intentionally scoped to the supported method set above, not the full interactive shell language;
distinctis not surfaced as a query capability (supports_distinct: false). -
No joins, subqueries, unions, CTEs, window functions, or
EXPLAINat the query-capability level. -
Transactions are advertised at the capability level (
supports_transactions: true) but without isolation levels, savepoints, nested transactions, read-only, or deferrable support. -
DDL is not transactional (
transactional_ddl: false); create-database, create-collection, alter, views, and triggers are not supported.