Skip to content

Commit 1e30060

Browse files
author
Sam Kleinman
committed
DOCS-247: corrections in response to technical review
1 parent 7c43217 commit 1e30060

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

source/core/sharding-internals.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,16 @@ sufficient split-ability.
257257
Indexes
258258
-------
259259

260-
All sharded collections **must** have an index on the :term:`shard
261-
key`. If you shard a collection that does not yet contain documents
262-
and does *not* have this index specified, the
263-
:dbcommand:`shardCollection` will create an index on the shard key. If
264-
the collection already contains documents, you must create this index
265-
before using :dbcommand:`shardCollection`.
260+
All sharded collections **must** have an index that starts with the
261+
:term:`shard key`. If you shard a collection that does not yet contain
262+
documents and *without* such an index, the :dbcommand:`shardCollection`
263+
will create an index on the shard key. If the collection already
264+
contains documents, you must create an appropriate index before using
265+
:dbcommand:`shardCollection`.
266266

267267
.. versionchanged:: 2.2
268-
The index on the shard key can be an index of the shard key itself,
268+
The index on the shard key no longer needs to be identical to the
269+
shard key. This index can be an index of the shard key itself as before,
269270
or a :ref:`compound index <sharding-index-type-compound>` where the
270271
shard key is the prefix of the index. This index *cannot* be a
271272
multikey index.
@@ -291,6 +292,13 @@ and you want to replace this with an index on the field ``{ zipcode:
291292

292293
The index on the shard key **cannot** be a multikey index.
293294

295+
As above, an index on ``{ zipcode: 1, username: 1 }`` can only
296+
replace an index on ``zipcode`` if there are no array values for
297+
the ``username`` field.
298+
299+
If you drop the last appropriate index for the shard key, recover
300+
by recreating a index on just the shard key.
301+
294302
.. index:: balancing; internals
295303
.. _sharding-balancing-internals:
296304

0 commit comments

Comments
 (0)