mercredi 24 décembre 2014

MongoDB Sharding : What should be the Sharding key if we want to find records with more than one field


I am having collection ("links") with listed fields:



collection-name: "links"
1) url
2) title
3) score
4) description
5) ratings (embedded_many)
and having index on "url", "title", "score"


because I need to find links based on these ("url", "title", "score") fields. query like : matching "url", "title" and "score" equal, gte, lte.


I would like to apply sharing on links collection.


Please guide me what should be the sharing-key and why ?



1) Cardinality for each field
url: 50,40,059
title: 50,10,105
score: 50,40,059

2) If null values exists on those fields
title: could have null value.

3) Is those fields changing?
only 'score' is changing after period of time.




Aucun commentaire:

Enregistrer un commentaire