Provide a JSON view of event data in a MongoDB event store.
Motivation
During development or debugging, developers often need to view the event data of stored events. This is currently not possible through MongoDB Compass because the event data is stored in binary:
In order to view the event data, the developer would have to write a program that fetches the event from the store and decodes it using the registered decoder.
Storing the event data directly as JSON into the store is not an option because it is not guaranteed that events are encoded/decoded as JSON.
Proposal
Proposal is to implement a service that builds an eventually consistent JSON view of all events in the event store within a separate collection/database. If a developer requires a JSON view, the service can be easily added to an application and MongoDB Compass can still be used as the UI to search through the events.
package example
func example(store event.Store, bus event.Bus, col *mongo.Collection) {
// use the events in `store` to fill the JSON view collection `col` on startup.
// continuously build the view of published events by subscribing to `bus`.
svc := jsonview.New(store, bus, col)
errs, err := svc.Run(context.TODO())
}
Tasks
To be able to use the projection scheduling system within the JSON view builder, the scheduling system needs to be extended to allow for wildcard event subscriptions (because the view builder must subscribe to all events).
Summary
Provide a JSON view of event data in a MongoDB event store.
Motivation
During development or debugging, developers often need to view the event data of stored events. This is currently not possible through MongoDB Compass because the event data is stored in binary:
In order to view the event data, the developer would have to write a program that fetches the event from the store and decodes it using the registered decoder.
Storing the event data directly as JSON into the store is not an option because it is not guaranteed that events are encoded/decoded as JSON.
Proposal
Proposal is to implement a service that builds an eventually consistent JSON view of all events in the event store within a separate collection/database. If a developer requires a JSON view, the service can be easily added to an application and MongoDB Compass can still be used as the UI to search through the events.
Tasks
To be able to use the projection scheduling system within the JSON view builder, the scheduling system needs to be extended to allow for wildcard event subscriptions (because the view builder must subscribe to all events).