gravity9-tech / mongo-cse

Mongo Change Stream Enhancer divides Change Stream events into partitions and enables you to handle them in separate Threads, increasing throughput. It achieves that by creating a Change Stream per each partition (number is configurable) and handling each Change Stream in a dedicated Thread.
3 stars 1 forks source link

Allow partitioning by user-defined key #17

Closed piotrlg9 closed 9 months ago

piotrlg9 commented 10 months ago

There may be cases when default random distribution (by _id) may not be the best option.

For example:

collection A:

[{
  "_id": 1,
  "event": [ "details..." ],
  "collectionB_Id": 100
},
{
  "_id": 2,
  "event": [ "details..." ],
  "collectionB_Id": 100
},
{
  "_id": 3,
  "event": [ "details..." ],
  "collectionB_Id": 100
}]

All events for these documents should be handled inside the same partition.

In such cases it would be useful to define own partitioning key.

PiotrGravity commented 9 months ago

Solved in #40