> ## 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.

# Kolekcja Spelling Preferences

`spellingPreferences` przechowuje słownik każdego użytkownika: słowa dodane przez użytkownika za pomocą "Add to dictionary" w sprawdzaniu pisowni edytora. Jeden dokument na użytkownika. Właścicielem jest `web`, bez schematu Mongoose; kod to `services/web/app/src/Features/Spelling/LearnedWordsManager.mjs`.

#### Pola

| Pole | Typ | Znaczenie | Źródło |
| - | - | - | - |
| `_id` | ObjectId | Id dokumentu, tworzone przez upsert. | `LearnedWordsManager.mjs:21-31` |
| `token` | String | Id użytkownika. Wbrew nazwie trasy pisowni przekazują id zalogowanego użytkownika (`SessionManager.getLoggedInUserId`). | `LearnedWordsManager.mjs:23` |
| `learnedWords` | Array of String | Słowa dodane przez użytkownika. | `LearnedWordsManager.mjs:26` |

#### Kto zapisuje

| Kod | Co robi |
| - | - |
| `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` słowa z upsertem. Odmawia, gdy lista przekroczyłaby `Settings.maxDictionarySize` bajtów. |
| `LearnedWordsManager.mjs:38-47` (`unlearnWord`) | `POST /spelling/unlearn` (`router.mjs:1043-1047`, `SpellingController.mjs:66-79`): `$pull` słowa. |
| `LearnedWordsManager.mjs:84-86` (`deleteUsersLearnedWords`) | Usuwa dokument. Jego jedyna otoczka, `SpellingHandler.deleteUserDictionary` (`services/web/app/src/Features/Spelling/SpellingHandler.mjs:24-26`), nie jest wywoływana nigdzie w web ani w jego modułach. |

#### Kto odczytuje

| Kod | Co robi |
| - | - |
| `LearnedWordsManager.mjs:52-67` (`getLearnedWords`) | Zwraca słowa bez duplikatów. |
| `services/web/app/src/Features/Project/ProjectController.mjs:671` | Wysyła słownik do edytora przy otwarciu projektu (`SpellingHandler.getUserDictionary`). |

#### Indeksy

| Nazwa | Klucze | Opcje | Migracja |
| - | - | - | - |
| `token` | `{ token: 1 }` | | `tools/migrations/20190912145027_create_spellingPreferences_indexes.mjs` |

#### Uwagi

* Indeks nie jest unikalny; upsert na `token` utrzymuje jeden dokument na użytkownika.
* Usunięcie użytkownika nie usuwa tego dokumentu.


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