Im currently unable to create a new stream with a prefix, based on the other one.
one example stream can be:
person.admin
it seems like according to docs, https://developers.eventstore.com/server/v5/projections.html#user-defined-projections-api
fromStreamsMatching cant be done on a projections that "one-time".
I could not find any documentation with working code (TS/JS), that would allow me to use this projection to go from person.admin to user.admin
What do I need to do to allow my Continuous projection to work?
current behaviour:
0@$projections-user-result
want:
0@user-{USERNAME OR ID}-result
Projections:
options({
resultStreamName: "user-",
$includeLinks: true,
reorderEvents: false,
processingLag: 500
})
fromStreamsMatching('person.')
.when({
$init: function() {
return {
logins: 0,
}
},
login: function(state, event) {
state.logins += 1;
},
})
.outputState()
When I read the docs following the link in your question, I see this:
It says that the argument for the forStreamMatching function is a function that should return true of false given the stream name, like stream => stream.startsWith("person."). I am not sure where the docs say that it would work with a string prefix.
A warning: the ES6 syntax is only supported in ESDB >= 21.10