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

# Spelling Preferences 컬렉션

`spellingPreferences` 는 각 사용자의 사전, 즉 사용자가 편집기 맞춤법 검사에서 "Add to dictionary"로 추가한 단어를 보관합니다. 사용자당 문서 하나입니다. `web`이 소유하며 Mongoose 스키마는 없습니다. 코드는 `services/web/app/src/Features/Spelling/LearnedWordsManager.mjs`입니다.

#### 필드

| 필드 | 타입 | 의미 | 출처 |
| - | - | - | - |
| `_id` | ObjectId | 문서 id로, upsert가 생성합니다. | `LearnedWordsManager.mjs:21-31` |
| `token` | String | 사용자의 id입니다. 이름과 달리 맞춤법 라우트는 로그인한 사용자의 id(`SessionManager.getLoggedInUserId`)를 전달합니다. | `LearnedWordsManager.mjs:23` |
| `learnedWords` | Array of String | 사용자가 추가한 단어. | `LearnedWordsManager.mjs:26` |

#### 쓰는 코드

| 코드 | 하는 일 |
| - | - |
| `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`): 단어를 upsert와 함께 `$addToSet`합니다. 목록이 `Settings.maxDictionarySize` 바이트를 넘게 되면 거부합니다. |
| `LearnedWordsManager.mjs:38-47` (`unlearnWord`) | `POST /spelling/unlearn` (`router.mjs:1043-1047`, `SpellingController.mjs:66-79`): 단어를 `$pull`합니다. |
| `LearnedWordsManager.mjs:84-86` (`deleteUsersLearnedWords`) | 문서를 삭제합니다. 유일한 래퍼인 `SpellingHandler.deleteUserDictionary`(`services/web/app/src/Features/Spelling/SpellingHandler.mjs:24-26`)는 web이나 그 모듈 어디에서도 호출되지 않습니다. |

#### 읽는 코드

| 코드 | 하는 일 |
| - | - |
| `LearnedWordsManager.mjs:52-67` (`getLearnedWords`) | 중복을 제거한 단어를 반환합니다. |
| `services/web/app/src/Features/Project/ProjectController.mjs:671` | 프로젝트를 열 때 사전을 편집기로 보냅니다(`SpellingHandler.getUserDictionary`). |

#### 인덱스

| 이름 | 키 | 옵션 | 마이그레이션 |
| - | - | - | - |
| `token` | `{ token: 1 }` | | `tools/migrations/20190912145027_create_spellingPreferences_indexes.mjs` |

#### 참고

* 인덱스는 고유하지 않습니다. `token`에 대한 upsert가 사용자당 문서 하나를 유지합니다.
* 사용자를 삭제해도 이 문서는 삭제되지 않습니다.


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