I am investigating MongoDB's appropriateness for our use case. We have clients that generate log data, and most of our use cases for this DB involve querying by Client ID and a time range of when the log was generated.

I am aware that using a datetime for a shard key will lead to all writes being sent to a single writer. If we used a composite shard key of client ID + date, is my understanding correct that that will distribute writes across N instances, where N is the number of unique clients?

1 Answer 1


Yes, that's correct. It would be also beneficial for queries, I assume most of your queries will include Client ID as condition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.