Skip to content

Instantly share code, notes, and snippets.


briandonahue/projection.js Secret

Created Jul 21, 2014
What would you like to do?
Projection test
// EditionSearchModel,
// NOTE: this sample projection immediately stops in one-time mode unless you have
// either event_type1 or event_type1 events in the store
reorderEvents: true, // enables event reordering in a multi-stream projection
// event reordering attempts to feed the projection with events in a
// their natural order
processingLag: 500, // processing lag in ms allowing event reordering to happen
// fromStream('streamId') | fromStreams(['sream1', 'stream2']) | fromCategory('category')
//NOTE: fromCategory requires $by_category standard projection to be enabled
// .foreachStream() | .partitionBy(function(e) { return e.body.useId; })
$init: function () {
return { }; // initial state
$any: function(s, e) {
linkTo('hercules.readmodel-EditionSearchModel', e);
return s;
// .filterBy(f)/transformBy(f)
// .outputTo(name[, namePattern]) // defines a name for the output stream
//NOTE: filterBy(), transformBy(), emit(), linkTo(), copyTo() require "emit enabled" (see checkbox below)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.