Home · Apps · rl-main-infra · todo_api · todo_mobile
MongoDB schema documentation derived from Mongoose models in todo_api/src.
todolists (TodoList)todoitems (TodoItem)changelogs (ChangeLog)idempotencyrecords (IdempotencyRecord)TodoList Schema| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
_id |
ObjectId | yes | auto | GraphQL id mapping |
ownerId |
string | yes | - | Tenant/owner partition key |
title |
string | yes | - | Trimmed |
description |
string | no | - | Optional |
order |
number | no | 0 |
UI ordering |
version |
number | no | 1 |
Optimistic concurrency token |
createdAt |
Date | yes | auto | Timestamps enabled |
updatedAt |
Date | yes | auto | Timestamps enabled |
Indexes
{ ownerId: 1, updatedAt: 1 }TodoItem Schema| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
_id |
ObjectId | yes | auto | GraphQL id mapping |
ownerId |
string | yes | - | Owner partition key |
listId |
string | yes | - | Logical FK to TodoList._id |
title |
string | yes | - | |
description |
string | no | - | |
completed |
boolean | no | false |
|
labels |
string[] | no | [] |
Free-form tags |
dueDate |
Date | no | - | Optional deadline |
reminders |
Date[] | no | [] |
Scheduled reminders |
position |
number | no | 0 |
In-list ordering |
version |
number | no | 1 |
Optimistic concurrency token |
createdAt |
Date | yes | auto | |
updatedAt |
Date | yes | auto |
Indexes
{ ownerId: 1, listId: 1, position: 1 }{ ownerId: 1, updatedAt: 1 }ChangeLog Schema| Field | Type | Required | Notes |
|---|---|---|---|
_id |
ObjectId | yes | |
ownerId |
string | yes | Owner partition key |
type |
string | yes | e.g. LIST_UPSERT, ITEM_MOVE |
entityId |
string | yes | Target list/item id |
payload |
object | yes | Snapshot/tombstone payload |
createdAt |
Date | yes | Pull cursor base |
Indexes
{ ownerId: 1, createdAt: 1 }IdempotencyRecord Schema| Field | Type | Required | Notes |
|---|---|---|---|
ownerId |
string | yes | Owner partition key |
key |
string | yes | Client-provided idempotency token |
response |
object | yes | Cached SyncPushResult |
createdAt |
Date | yes | Auto timestamp |
updatedAt |
Date | yes | Auto timestamp |
Indexes
{ ownerId: 1, key: 1 }erDiagram
TODO_LIST ||--o{ TODO_ITEM : contains
TODO_LIST {
string id
string ownerId
string title
string description
number order
number version
date createdAt
date updatedAt
}
TODO_ITEM {
string id
string ownerId
string listId
string title
bool completed
number position
number version
date dueDate
date createdAt
date updatedAt
}
CHANGE_LOG {
string id
string ownerId
string type
string entityId
object payload
date createdAt
}
IDEMPOTENCY_RECORD {
string ownerId
string key
object response
date createdAt
}
TodoItem.listId and TodoList._id is enforced at service layer (ensureList) rather than MongoDB FK constraints.expectedVersion), enabling optimistic concurrency during sync.