Hashed Shard Key or Ranged Shard Key

Dear All Experts,

Here I have a 300+GB collection, which I need search documents by a specific date, and most likely around 2800 documents related to that one specified date. I just test this query on standalone Mongod, the response time is more than 2 seconds, which I need it to be less than 1 or even 0.5 seconds. Consequently, I’m considering sharding, is that hashed shard key on date field will fit my requirement?

Good day!

Best regards,

Have you try an index on the date before considering sharding. Performance will be affected by the size of the memory on the server. However processing 2800 documents at each query will necessary take some time and the network will become an important part. A schema change might be necessary. There are design patterns, https://www.mongodb.com/blog/post/building-with-patterns-a-summary, that might help.