Commit abcaa1d
feat: add MongoDB driver support (#482)
* feat: add MongoDB driver support
Add MongoDB as the 11th supported database driver, enabling document
database operations via the existing `Connector` interface.
- New driver at `packages/drivers/src/mongodb.ts` supporting:
- Full MQL command set: find, aggregate, CRUD, indexes, collection mgmt
- Cross-database queries via per-query `database` field
- BSON type serialization (ObjectId, Decimal128, Long, UUID, Binary, Date)
- Schema introspection via document sampling with field type inference
- Connection string URI and host/port/user/password auth
- `authorizedDatabases` fallback for restricted-privilege users
- Registration in driver index, config normalizer (with `mongo`/`mongodb` aliases), and connection registry
- CI: MongoDB 7.0 service in driver-e2e workflow with health checks
- 90 E2E tests including:
- CRUD operations, aggregation pipelines, schema introspection
- Cross-database operations, index management, collection lifecycle
- Adversarial tests: deeply nested docs, special characters, heterogeneous
collections, concurrent operations, large documents, numeric edge cases
Closes #480
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address multi-model code review findings for MongoDB driver
Fixes from 6-model consensus review (Claude, GPT 5.2 Codex, Gemini 3.1
Pro, Kimi K2.5, MiniMax M2.5, GLM-5):
- Cap user-specified `limit` against `effectiveLimit` to prevent OOM
from unbounded queries (flagged by Gemini)
- Add `ping` command for connection testing instead of querying
`system.version` which may not be accessible (flagged by Gemini, GLM-5)
- Add `e.code === 26` fallback for `dropCollection` error handling
across MongoDB versions (flagged by GLM-5)
- Fix misleading docstring on `extractFields` that claimed dot-notation
expansion (flagged by Gemini)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address CodeRabbit findings and update docs for MongoDB driver
CodeRabbit review fixes:
- Use `...COMMON_ALIASES` spread in `MONGODB_ALIASES` for consistency
with other drivers (normalize.ts)
- Scan entire aggregate pipeline for `$limit` instead of only last
stage; also skip auto-limit for `$out`/`$merge` write pipelines
- Keep `mongodb` at `^6.0.0` (NOT upgrading to v7): v7 drops Node 16/18
support and has many breaking changes; v6.21.0 is actively maintained
and supports MongoDB server 3.6-8.0
Additional review fixes:
- Include database name in URI when building from individual config
fields for correct auth-source resolution (GLM-5)
- Add security comment about credential exposure in URI (Kimi K2.5)
Documentation updates:
- `docs/docs/drivers.md`: add MongoDB to support matrix (11 databases),
install section, auth methods, auto-discovery
- `docs/docs/configure/warehouses.md`: add MongoDB configuration section
with connection string and field-based examples, server compatibility
- `docs/docs/data-engineering/tools/warehouse-tools.md`: add MongoDB to
Docker discovery and env var detection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* style: format MongoDB driver files with Prettier
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: cap aggregate `$limit` and serialize `distinct` values (CodeRabbit)
- Cap user-specified `$limit` in aggregate pipelines against
`effectiveLimit` to prevent OOM, matching the `find` command behavior
- Serialize `distinct` return values through `serializeValue()` for
consistent BSON type handling across find/aggregate/distinct
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 91fe351 commit abcaa1d
File tree
11 files changed
+2923
-30
lines changed- .github/workflows
- docs/docs
- configure
- data-engineering/tools
- packages
- drivers
- src
- opencode
- src/altimate/native/connections
- test/altimate
11 files changed
+2923
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
| |||
195 | 206 | | |
196 | 207 | | |
197 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
198 | 216 | | |
199 | 217 | | |
200 | 218 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
240 | 285 | | |
241 | 286 | | |
242 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
167 | | - | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
132 | 144 | | |
133 | 145 | | |
134 | 146 | | |
| |||
167 | 179 | | |
168 | 180 | | |
169 | 181 | | |
170 | | - | |
| 182 | + | |
171 | 183 | | |
172 | 184 | | |
173 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| 18 | + | |
0 commit comments