> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Collection Spelling Preferences

`spellingPreferences` lưu từ điển của mỗi người dùng: các từ người dùng đã thêm qua "Add to dictionary" trong trình kiểm tra chính tả của trình soạn thảo. Mỗi người dùng một tài liệu. `web` sở hữu collection này, không có schema Mongoose; mã là `services/web/app/src/Features/Spelling/LearnedWordsManager.mjs`.

#### Trường

| Trường | Kiểu | Ý nghĩa | Nguồn |
| - | - | - | - |
| `_id` | ObjectId | Id tài liệu, được tạo bởi upsert. | `LearnedWordsManager.mjs:21-31` |
| `token` | String | Id của người dùng. Dù tên như vậy, các route chính tả truyền id của người dùng đang đăng nhập (`SessionManager.getLoggedInUserId`). | `LearnedWordsManager.mjs:23` |
| `learnedWords` | Array of String | Các từ người dùng đã thêm. | `LearnedWordsManager.mjs:26` |

#### Ai ghi

| Mã | Chức năng |
| - | - |
| `LearnedWordsManager.mjs:13-32` (`learnWord`) | `POST /spelling/learn` (`services/web/app/src/router.mjs:1037-1041`, `services/web/app/src/Features/Spelling/SpellingController.mjs:45-58`): `$addToSet` từ đó, kèm upsert. Từ chối khi danh sách sẽ vượt quá `Settings.maxDictionarySize` byte. |
| `LearnedWordsManager.mjs:38-47` (`unlearnWord`) | `POST /spelling/unlearn` (`router.mjs:1043-1047`, `SpellingController.mjs:66-79`): `$pull` từ đó. |
| `LearnedWordsManager.mjs:84-86` (`deleteUsersLearnedWords`) | Xóa tài liệu. Hàm bao duy nhất của nó, `SpellingHandler.deleteUserDictionary` (`services/web/app/src/Features/Spelling/SpellingHandler.mjs:24-26`), không được gọi ở đâu trong web hay các module của nó. |

#### Ai đọc

| Mã | Chức năng |
| - | - |
| `LearnedWordsManager.mjs:52-67` (`getLearnedWords`) | Trả về các từ không trùng lặp. |
| `services/web/app/src/Features/Project/ProjectController.mjs:671` | Gửi từ điển tới trình soạn thảo khi mở dự án (`SpellingHandler.getUserDictionary`). |

#### Chỉ mục

| Tên | Khóa | Tùy chọn | Migration |
| - | - | - | - |
| `token` | `{ token: 1 }` | | `tools/migrations/20190912145027_create_spellingPreferences_indexes.mjs` |

#### Ghi chú

* Chỉ mục không duy nhất; thao tác upsert trên `token` giữ một tài liệu cho mỗi người dùng.
* Xóa người dùng không xóa tài liệu này.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.