Diggsey / meteor-reactive-publish

Enable server-side reactivity for Meteor.publish
MIT License
41 stars 5 forks source link

Calls to reactive findOne() instead of find() causes fallback to PollingObserveDriver #5

Closed yeputons closed 10 years ago

yeputons commented 10 years ago

Gist, requires Meteor with oplog driver (I've tested it under 0.7.2 and 0.8.0).

Add facts and reactive-publish packages and run Meteor. You ca n see 'observe-drivers-polling: 40', which means that there are 40 requests that are served by PollingObserveDriver instead of OplogObserveDriver (more info). I think that these are the ones caused by Items.findOne() call.

Diggsey commented 10 years ago

This appears to be a limitation of the oplog driver, which can't cope with: "Queries specifying the limit option without a sort specifier or with a sort based on $natural order". I would expect the same behaviour if you try to return a limited cursor from a publish function without this package even being installed. This limitation does seem a little arbitrary since you could theoretically "sort" on a field which is identical for all records and it wouldn't affect the order but the oplog driver should work...

yeputons commented 10 years ago

@Diggsey I see, thank you for the clarification. I didn't think about findOne from that point of view.