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

# Collezione Spelling Preferences

`spellingPreferences` contiene il dizionario di ogni utente: le parole che l'utente ha aggiunto tramite "Add to dictionary" nel controllo ortografico dell'editor. Un documento per utente. Ne è proprietario `web`, senza schema Mongoose; il codice è `services/web/app/src/Features/Spelling/LearnedWordsManager.mjs`.

#### Campi

| Campo | Tipo | Significato | Fonte |
| - | - | - | - |
| `_id` | ObjectId | Id del documento, creato dall'upsert. | `LearnedWordsManager.mjs:21-31` |
| `token` | String | L'id dell'utente. Nonostante il nome, le route di ortografia passano l'id dell'utente connesso (`SessionManager.getLoggedInUserId`). | `LearnedWordsManager.mjs:23` |
| `learnedWords` | Array of String | Le parole aggiunte dall'utente. | `LearnedWordsManager.mjs:26` |

#### Chi la scrive

| Codice | Cosa fa |
| - | - |
| `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` della parola, con upsert. Rifiuta quando l'elenco supererebbe `Settings.maxDictionarySize` byte. |
| `LearnedWordsManager.mjs:38-47` (`unlearnWord`) | `POST /spelling/unlearn` (`router.mjs:1043-1047`, `SpellingController.mjs:66-79`): `$pull` della parola. |
| `LearnedWordsManager.mjs:84-86` (`deleteUsersLearnedWords`) | Elimina il documento. Il suo unico wrapper, `SpellingHandler.deleteUserDictionary` (`services/web/app/src/Features/Spelling/SpellingHandler.mjs:24-26`), non ha chiamanti in web né nei suoi moduli. |

#### Chi la legge

| Codice | Cosa fa |
| - | - |
| `LearnedWordsManager.mjs:52-67` (`getLearnedWords`) | Restituisce le parole senza duplicati. |
| `services/web/app/src/Features/Project/ProjectController.mjs:671` | Invia il dizionario all'editor quando si apre un progetto (`SpellingHandler.getUserDictionary`). |

#### Indici

| Nome | Chiavi | Opzioni | Migrazione |
| - | - | - | - |
| `token` | `{ token: 1 }` | | `tools/migrations/20190912145027_create_spellingPreferences_indexes.mjs` |

#### Note

* L'indice non è univoco; l'upsert su `token` mantiene un documento per utente.
* L'eliminazione di un utente non elimina questo documento.


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