How mongodb/mongo works
MongoDB is a database server (mongod) with a sharding router (mongos). The README’s user workflow is a client connecting to a running server; it also describes a single-server setup. Sampled source shows internal query-settings management, hybrid-search pipeline construction, query-analysis command execution, and oplog visibility coordination. The source excerpts do not establish the full request-routing or query-execution path, so those connections are not expanded here. Some nodes represent broader runtime subsystems supported by the repository tree, not inspected implementation details.
Main entry points: query_settings_service.cpp Query settings service · storage_oplog_manager.cpp Oplog visibility · query_analysis_client.cpp Query analysis client · pipeline Aggregation pipelines
Components 16
Client entry
- Database server
- Sharding router
Query processing
- Query execution
src/mongo/db/query - Aggregation pipelines
src/mongo/db/pipeline - Hybrid search builder
src/mongo/db/pipeline/hybrid_search_pipeline_builder.cpp - Query settings service
src/mongo/db/query/query_settings/query_settings_service.cpp
Cluster services
- Query analysis client
src/mongo/s/query_analysis_client.cpp - Replication coordination
src/mongo/db/repl
Storage and primitives
- Storage engine
src/mongo/db/storage - Oplog visibility
src/mongo/db/storage/storage_oplog_manager.cpp - Record store
src/mongo/db/storage/record_store.h - BSON documents
src/mongo/bson/bsonobj.h - BSON types
src/mongo/bson/bsontypes.h - Structured logging
src/mongo/logv2/log.h - Error handling
src/mongo/util/assert_util.h
Other components
- MongoDB client
Connections 12
- MongoDB client → Database server: connects to
- MongoDB client → Sharding router: routes through
- Sharding router → Database server: dispatches requests
- Query settings service → Aggregation pipelines: builds contexts
src/mongo/db/query/query_settings/query_settings_service.cpp - Query settings service → BSON documents: parses commands
src/mongo/db/query/query_settings/query_settings_service.cpp - Hybrid search builder → Aggregation pipelines: constructs stages
src/mongo/db/pipeline/hybrid_search_pipeline_builder.cpp - Query analysis client → Replication coordination: checks primary
src/mongo/s/query_analysis_client.cpp - Query analysis client → Database server: runs local commands
src/mongo/s/query_analysis_client.cpp - Oplog visibility → Record store: reads oplog
src/mongo/db/storage/storage_oplog_manager.cpp - Oplog visibility → Storage engine: tracks visibility
src/mongo/db/storage/storage_oplog_manager.cpp - Oplog visibility → Structured logging: logs visibility
src/mongo/db/storage/storage_oplog_manager.cpp - Query settings service → Structured logging: logs lookup failures
src/mongo/db/query/query_settings/query_settings_service.cpp