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
Copy file name to clipboardExpand all lines: articles/cosmos-db/mongodb/indexing.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,19 @@ In the API for MongoDB, compound indexes are **required** if your query needs th
52
52
53
53
A compound index or single field indexes for each field in the compound index will result in the same performance for filtering in queries.
54
54
55
-
Compounded indexes on nested fields are not supported by default due to limiations with arrays. If your nested field does not contain an array, the index will work as intended. If your nested field contains an array, that value will be ignored in the index. This feature can be enabled for your database account by [enabling the 'EnableUniqueCompoundNestedDocs' capability](how-to-configure-capabilities.md).
55
+
Compounded indexes on nested fields are not supported by default due to limiations with arrays. If your nested field does not contain an array, the index will work as intended. If your nested field contains an array (anywhere on the path), that value will be ignored in the index.
56
+
57
+
For example a compound index containing people.tom.age will work in this case since there's no array on the path:
This feature can be enabled for your database account by [enabling the 'EnableUniqueCompoundNestedDocs' capability](how-to-configure-capabilities.md).
67
+
56
68
57
69
> [!NOTE]
58
70
> You can't create compound indexes on arrays.
@@ -246,7 +258,19 @@ In the preceding example, omitting the ```"university":1``` clause returns an er
246
258
247
259
Unique indexes need to be created while the collection is empty.
248
260
249
-
Unique indexes on nested fields are not supported by default due to limiations with arrays. If your nested field does not contain an array, the index will work as intended. If your nested field contains an array, that value will be ignored in the unique index and uniqueness wil not be preserved for that value. This feature can be enabled for your database account by [enabling the 'EnableUniqueCompoundNestedDocs' capability](how-to-configure-capabilities.md).
261
+
Unique indexes on nested fields are not supported by default due to limiations with arrays. If your nested field does not contain an array, the index will work as intended. If your nested field contains an array (anywhere on the path), that value will be ignored in the unique index and uniqueness wil not be preserved for that value.
262
+
263
+
For example a unique index on people.tom.age will work in this case since there's no array on the path:
0 commit comments