Skip to content

Commit 630890a

Browse files
authored
Update sharding docs re: keys with "." characters in them (#5588)
1 parent cc0cd85 commit 630890a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

source/reference/sharding.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ configured in the association as the field name:
8383
index country: 1
8484
end
8585

86+
The shard key may also reference a field in an embedded document, by using
87+
the "." character to delimit the field names:
88+
89+
.. code-block:: ruby
90+
91+
shard_key "location.x" => 1, "location.y" => 1
92+
93+
shard_key "location.x", "location.y"
94+
95+
.. note::
96+
97+
Because the "." character is used to delimit fields in embedded documents,
98+
Mongoid does not currently support shard key fields that themselves
99+
literally contain the "." character.
100+
86101
.. note::
87102

88103
If a model declares a shard key, Mongoid expects the respective collection

0 commit comments

Comments
 (0)