You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** If you set <code>index: true</code> or <code>unique: true</code> on a field that is also
70
-
<code>localized: true</code>, the database will create one index <strong>per locale path</strong>
71
-
(for example, <code>slug.en</code>, <code>slug.da-dk</code>, ...). With many locales and several
72
-
indexed fields, this can significantly increase the total number of indexes on a collection and may
73
-
approach MongoDB’s per-collection index limit.
74
-
</Banner>
75
-
76
-
<strong>Recommendations</strong>
77
-
- Only index the specific locale paths you actually query by using the collection-level
78
-
<code>indexes</code> option instead of setting <code>index: true</code> directly on a localized field.
79
-
- Prefer narrowly scoped or compound indexes tailored to your queries.
68
+
When you set `index: true` or `unique: true` on a localized field, MongoDB creates one index **per locale path** (e.g., `slug.en`, `slug.da-dk`, etc.). With many locales and indexed fields, this can quickly approach MongoDB's per-collection index limit.
80
69
81
-
<strong>Example: index a specific localeonly</strong>
70
+
If you know you'll query specifically by a locale, index only those locale paths using the collection-level `indexes` option instead of setting `index: true` on the localized field. This approach gives you more control and helps avoid unnecessary indexes.
0 commit comments