After some Trial and error, I was able to achieve this using below configs:

  1. Using pipeline to listen for change events on multiple MongoDB collections, and publish them to a Kafka topic.
    “pipeline”: “[{"$match":{"$and":[{"ns.db":{"$regex":/^database_[0-9]{4}[0-1][1-9]$/}},{"ns.coll":{"$regex":/^collection_pattern_/}}]}}]”

  2. Using topic.namespace.map and pipeline to publish events from multiple source into single kafka topic.
    “topic.namespace.map”: “{"/database_\d{6}(?:\.collection_pattern_\d{6})?":"single-topicname"}”