Hi everyone,
if you don’t mind, did anyone work with Mongo Views in Meteor? Can we use a View in pub-sub the same way we use Collections and keep subscription reactive?
I’m asking because I’m experiencing bizzare issues and not sure whether that’s an expected behavior or not. Basically:
- I have created a View in Mongo, that join couple of collections together;
- I query that view in publication in 2 different ways:
- by document ids, like MyView.find({_id:{"$in": [IDS]}}, options);
- by document ids + some additional filter, like MyView.find({_id:{"$in": [IDS]}, fieldN: “xxx”}, options);
What I see if I query documents by ids only:
- View return a bunch of documents and I see self.added fired for those documents.
- In about 3-5 seconds I see self.changed fired on same documents with an empty ‘fields’ parameter
What I see if I query documents by ids + filter:
- View return a bunch of documents and I see self.added fired for those documents.
- In about 3-5 seconds I see self.removed fired on same documents and those documents are removed from UI;
Why such a different behavior for 2, essentially, similar queries?