-
Notifications
You must be signed in to change notification settings - Fork 0
Database
zion edited this page Jan 19, 2025
·
1 revision
Read my blog post on how I came to choose MongoDB for this project here.
| Field | Type |
|---|---|
_id |
ObjectId |
| name | string |
string |
|
| username | string |
| created_at | Date |
-
email, for quickly retrieving a user using their email address
| Field | Type |
|---|---|
_id |
ObjectId |
| owner | _id |
| title | string |
| author | string |
| notes | string |
| link | string |
| read | boolean |
| in_folder |
ObjectId or null
|
| created_at | Date |
| last_modified | Date |
- Composite index on
(owner, in_folder), for quickly retrieving a user's items
| Field | Type |
|---|---|
_id |
ObjectId |
| owner | ObjectId |
| name | string |
| public | boolean |
| created_at | Date |
| last_modified | Date |
-
owner, for quickly retrieving a user's folders
| Field | Type |
|---|---|
_id |
ObjectId |
| recipient | ObjectId |
| actor | ObjectId |
| post | ObjectId |
| created_at | Date |
| type | string |
| is_read | boolean |
- Composite index on
(recipient, created_at), for quickly retrieving a user's notifications in sorted order
| Field | Type |
|---|---|
_id |
ObjectId |
| owner | ObjectId |
| content | string |
| attachments | string |
| like_count | number |
| comment_count | number |
| created_at | Date |
| last_modified | Date |
(owner)
| Field | Type |
|---|---|
_id |
ObjectId |
| owner | ObjectId |
| post | ObjectId |
| created_at | Date |
-
post, for quickly retrieving likes on a post,ownerfor quickly retrieving a user's own likes
| Field | Type |
|---|---|
_id |
ObjectId |
| author | ObjectId |
| post | ObjectId |
| content | string |
| created_at | Date |
| last_modified | Date |
-
post, for quickly retrieving comments on a post
| Field | Type |
|---|---|
_id |
ObjectId |
| sender | ObjectId |
| receiver | ObjectId |
-
receiver, for quickly retrieving a user has received, andsender, for quickly retrieving requests a user has sent
| Field | Type |
|---|---|
_id |
ObjectId |
| user_one | ObjectId |
| user_two | ObjectId |
- Composite index on
(user_one, user_two), for quickly retrieving friendships