checking if stream exists in projection

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

Jet.com

Is this on 3.0.0?

No, rc2. Fair enough, I’ll check 3.0.0.

I think it will still fail on 3.0 I ask because I am wondering if the
delete of the projection might have failed. As of now its thinking
there is another projection running (the deleted one)