Ask Your Question
4

What does the error "couldn't find valid index for shard key" and code "96" indicate when ShardCollection fails?

asked 2023-06-07 15:37:11 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-07 16:02:02 +0000

devzero gravatar image

The error "couldn't find valid index for shard key" and code "96" indicates that the sharding process has failed because the sharded collection does not have a valid index for its shard key. This error typically occurs when attempting to shard a collection that does not have a unique index on the shard key field.

To resolve this issue, you must create an index on the shard key field before attempting to shard the collection. Additionally, the shard key field should be a unique identifier for each document in the collection to ensure even distribution of data across shards.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-07 15:37:11 +0000

Seen: 8 times

Last updated: Jun 07 '23