I want to split an observable array (cursor) into two separate streams based on a string property value on the observable object.
I’m using meteor observable like so:
this.entitiesSub = MeteorObservable.subscribe('entities', this.jobId).subscribe(() => {
this.entities = Entities.find({"job.jobId":jobId });
then I would like to create two new streams like so:
this.stream1 = this.entities.filter(x => x.type == "test1");
this.stream2 = this.entities.filter(x => x.type == "test2");
But this doesn’t seem to work. I read somewhere you have to make the observable “hot” (I still don’t really understand that), so I tried the following and then filtering from that but still no luck…:
this.hotEntities = this.entities.share();