Files
wekan/docs/Databases/MongoDB/README.md
T
Lauri Ojansivu 03ffb56a5e Index card_comment_reactions, and document why MongoDB's data directory must be local.
From a reported MongoDB crash series (.tools/crash: WeKan and MongoDB in one
Kubernetes pod, the database volume on an SMB/DFS share):

- The crash itself is WiredTiger's checkpoint fsync() returning ENOSPC
  ("No space left on device" with 519 MB used and 10 GiB free) on the
  network share, followed by a fatal assertion and abort - every checkpoint,
  so a restart loop. That is the storage, not WeKan: MongoDB requires a
  local filesystem with real fsync semantics under its data directory.
  docs/Databases/MongoDB/Storage-Requirements.md now says so, shows what
  the log looks like when it is not, and what to do (local block volume;
  attachments may still live on a share; MONGO_URL over TCP is fine).
- The WeKan-side finding in the same logs: card_comment_reactions had no
  index at all, and every board open queried it by `cardId: { $in: [...] }`
  and by `boardId` as a full collection scan - 3,397 COLLSCANs of that one
  collection in the last crash log, up to 1.6 s each, the bulk of its
  "Slow query" lines. server/models/cardCommentReactions.js now ensures
  indexes on cardId, boardId and cardCommentId at startup, like every other
  per-card collection.

tests/cardCommentReactionsIndexes.test.cjs pins both.

Thanks to xet7 !
2026-09-11 11:23:53 +03:00

26 lines
1.6 KiB
Markdown

# MongoDB
WeKan's classic database. WeKan runs on MongoDB 3.0 … 8.0, and picks the Node
driver for the server it finds; [docker-compose-mongodb-v7.yml](https://github.com/wekan/wekan/blob/main/docker-compose-mongodb-v7.yml)
is the compose file for it. The default database of WeKan is
[FerretDB v1](../FerretDB/1) instead, which needs no database server.
| File | What it answers |
| --- | --- |
| [Driver-System.md](Driver-System.md) | Which Node driver is used for which server version, and how that is decided |
| [Version-Management.md](Version-Management.md) | Detecting the server version and switching to the matching binary + driver |
| [Compatibility-Guide.md](Compatibility-Guide.md) | What breaks between MongoDB 3.0 and 8.0 with Meteor, and the fixes |
| [Storage-Requirements.md](Storage-Requirements.md) | Why the data directory must be on a local filesystem, and what an SMB/NFS-backed one does (fsync ENOSPC aborts, slow queries) |
| [Oplog-Configuration.md](Oplog-Configuration.md) | Why the OpLog matters for pub/sub, and how to turn it on |
| [OpLog-Enablement.md](OpLog-Enablement.md) | Whether it IS on, per deployment platform |
| [avx-qemu.md](avx-qemu.md) | Running MongoDB 5+ on a CPU with no AVX, through qemu-user |
| [raspi4-qemu.md](raspi4-qemu.md) | The same on a Raspberry Pi 4 and older (ARMv8.0, no ARMv8.2-A) |
Both qemu pages describe what WeKan's `cpu-exec` helper now does by itself: it
runs a binary under qemu-user when the CPU lacks the features that binary needs.
## See also
- [../FerretDB/1](../FerretDB/1) — the default database, and the four SQL backends behind it
- [../Migrations](../Migrations) — WeKan's own schema migrations