Using partial indexes in sharded collections v. 4.4

Hi Everybody.

I am working with sharding these days, MongoDB 4.4. So far so good!
I wonder if I can use a partial index for shard-key, considering that in this version
it could be somehow nullable.

Thank you so much for your attention.

Hi @Francesco_Carucci,

Welcome to MongoDB community.

A shard key entry must be present in any document of the sharded collection otherwise the sharding mechanism will not be able to work and distribute data.

A partial index contradicts this assumption as it means some documents will not be present in that index otherwise its not partial…

Hope this explains it.


Thank you so much for your answer.

I appreciate.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.