anchor.diff:  |[[mongodb-outbox-event-router-property-route-by-field]]<<mongodb-outbox-event-router-property-route-by-field, `route.by.field`>>
   |`aggregatetype`
   |Router
  -|Specifies the name of a field in the outbox collection. The default behavior is that the value in this field becomes a part of the name of the topic to which the connector emits the outbox messages. An example is in the xref:route-by-field-example[description of the expected outbox collection].
  +|Specifies the name of a field in the outbox collection.
  +By default, the value specified in this field becomes a part of the name of the topic to which the connector emits the outbox messages.
  +For an example, see the xref:mongodb-outbox-route-by-field-example[description of the expected outbox collection].
   
   |[[mongodb-outbox-event-router-property-route-topic-regex]]<<mongodb-outbox-event-router-property-route-topic-regex, `route.topic.regex`>>
   |`(?<routedByValue>.*)`
  
positive.code: 
  toc::[]
  
  ifdef::community[]
  [NOTE]
  ====
  The MongoDB Outbox Event Router SMT is under active development. The structure of the emitted message or other details might change as development progresses.
  ====
  endif::community[]
  
  [NOTE]
  ====
  This SMT is supported only for the MongoDB connector.
  See xref:transformations/outbox-event-router.adoc[Outbox Event Router] for the relational database equivalent to this SMT.
  ====
  
  The outbox pattern is a way to safely and reliably exchange data between multiple (micro) services. An outbox pattern implementation avoids inconsistencies between a service's internal state (as typically persisted in its database) and state in events consumed by services that need the same data.
  
  To implement the outbox pattern in a {prodname} application, configure a {prodname} connector to:
  
  * Capture changes in an outbox collection
  * Apply the {prodname} MongoDB outbox event router single message transformation (SMT)
  
  A {prodname} connector that is configured to apply the MongoDB outbox SMT should capture changes that occur in an outbox collection only.
  For more information, see xref:options-for-applying-the-transformation-selectively[Options for applying the transformation selectively].
  
  A connector can capture changes in more than one outbox collection only if each outbox collection has the same structure.
  
  [NOTE]
  ====
  To use this SMT, operations on the actual business collection(s) and the insert into the outbox collection must be done as part of a multi-document transaction, which have been being supported since MongoDB 4.0, to prevent potential data inconsistencies between business collection(s) and outbox collection. For future update, to enable updating existing data and inserting outbox event in an ACID transaction without multi-document transactions, we have planned to support additional configurations for storing outbox events in a form of a sub-document of the existing collection, rather than an independent outbox collection.
  ====
  
  See link:https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/[Reliable Microservices Data Exchange With the Outbox Pattern] to learn about why the outbox pattern is useful and how it works.
  
  ifdef::product[]
  The following topics provide details:
  
  * xref:example-of-a-debezium-outbox-message[]
  * xref:outbox-collection-structure-expected-by-debezium-mongodb-outbox-event-router-smt[]
  * xref:basic-debezium-mongodb-outbox-event-router-smt-configuration[]
  * xref:using-avro-as-the-payload-format-in-debezium-outbox-messages[]
  * xref:emitting-additional-fields-in-debezium-outbox-messages[]
  * xref:options-for-configuring-mongodb-outbox-event-router-transformation[]
  endif::product[]
  
  // Type: concept
  // ModuleID: example-of-a-debezium-outbox-message
  // Title: Example of a {prodname} outbox message
  [[example-outbox-message]]
  == Example outbox message
  
  To learn about how to configure the {prodname} outbox event router SMT, consider the following example of a {prodname} outbox message:
  
  [source,javascript,indent=0]
  ----
  
negative.code: }
  ----
  
  You can configure the outbox event router to expand the message content, converting the escaped JSON back to its original, unescaped JSON format.
  In the converted string, the companion schema is deduced from the original JSON document.
  The following examples shows the expanded JSON in the resulting Kafka message:
  
  [source,javascript,indent=0]
  ----
  