Hi,
I have a projection that creates new streams out of the body of another event, something like that:
Stream: source
Event: created : { codes : [ “a”, “b”, “c”] }
Projection:
fromStream(‘source’)
.when({
created: function (s, e) {
for (i = 0; i < e.body.codes.length; i++) {
emit(‘generated-’ + e.body.codes[i], “created”, {});
};
return s;
}
});
At some point, this projection was accidentally duplicated so I ended up with them clashing when trying to create new streams.
I deleted both projections and tried to create a new one. Now it immediately fails with
Multiple projections emitting to the same stream detected. Stream: ‘generated-a’. Last event projection: ‘6’. Emitting projection: ‘29’
One solution would be to create streams only if they don’t already exist. I can’t figure out how to do that.
Suggestions will be much appreciated.
Regards,
Dmitry