feat: update default persistence to MongoDB and enhance configuration options
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m19s
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m19s
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
### 3. `LockedTable` MongoDB adapter
|
||||
- Refactor `backend/db/db.py` so that each exported `*_db` object continues to expose the same methods: `search(...)`, `get(...)`, `all()`, `insert(...)`, `insert_multiple(...)`, `update(...)`, `remove(...)`, `truncate()`.
|
||||
- Implement a new `MongoLockedTable` class that mirrors the existing `LockedTable` API but delegates to a MongoDB collection.
|
||||
- Keep `LockedTable` (TinyDB) as a fallback selectable by `USE_MONGODB=true|false` (default `false`).
|
||||
- Keep `LockedTable` (TinyDB) as a fallback selectable by `USE_MONGODB=true|false` (default `true`).
|
||||
- Store the model `id` field as MongoDB `_id` on writes; do not keep a duplicate `id` field in storage.
|
||||
- Restore the model `id` field from `_id` on reads and return TinyDB-compatible `Document` objects with `doc_id` set so existing callers that rely on `doc_id` continue to work.
|
||||
- Support `update(fields, doc_ids=[...])` and callable updater functions (`update(lambda rec: ..., cond)`) to match TinyDB behavior.
|
||||
@@ -98,9 +98,9 @@
|
||||
```
|
||||
|
||||
### 6. Environment variables
|
||||
- `MONGO_URI` — required when `USE_MONGODB=true`.
|
||||
- `MONGO_URI` — required when `USE_MONGODB=true` (the default).
|
||||
- `MONGO_DB_NAME` — optional database name; defaults parsed from `MONGO_URI` or falls back to `chore_db`/`chore_db_test`/`chore_db_e2e` based on `DB_ENV`/`DATA_ENV`.
|
||||
- `USE_MONGODB` — `true` to use MongoDB backend; `false` to keep TinyDB.
|
||||
- `USE_MONGODB` — `true` to use MongoDB backend (default); `false` to keep TinyDB.
|
||||
|
||||
### 7. Default data initialization
|
||||
- `backend/db/default.py` (`initializeImages`, `createDefaultTasks`, `createDefaultRewards`) must work with the new MongoDB-backed `*_db` objects. No API changes.
|
||||
|
||||
Reference in New Issue
Block a user