Skip to content

Commit

Permalink
Update sharding docs re: keys with "." characters in them (mongodb#5588)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis authored Mar 28, 2023
1 parent 3a81b80 commit 9e909b7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/reference/sharding.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ configured in the association as the field name:
index country: 1
end

The shard key may also reference a field in an embedded document, by using
the "." character to delimit the field names:

.. code-block:: ruby

shard_key "location.x" => 1, "location.y" => 1

shard_key "location.x", "location.y"

.. note::

Because the "." character is used to delimit fields in embedded documents,
Mongoid does not currently support shard key fields that themselves
literally contain the "." character.

.. note::

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

0 comments on commit 9e909b7

Please sign in to comment.