I am probably missing something quite obvious or missing something in the documentation. I searched and did not find similar question. posting it.
Both of these
return Items.find({},{sort: {time: -1}, limit: 10});
or
return Items.find({},{sort: {time: -1}).limit(10);
result in meteor cannot observe queries with skip or limit
UPDATE: This is longer an issue. Beginning with Meteor 0.5.3, you can observe queries with
skipandlimitoptions.Unfortunately, this is true: the mimimongo package doesn’t currently support calling
observeon cursors that used theskiporlimitoptions. There’s no good reason for this; it’s just not implemented.If you’re calling this query inside a template helper, there’s an easy workaround:
The downside of the workaround is efficiency. If your helper returns a cursor (just returning the value of
Items.findwithout callingfetch, then the template system is smart enough not to recalculate the whole template when just one item changes, or if a new item is inserted.On the other hand, calling
fetchin the helper registers a dependency on the entire query result, so the whole template gets recalculated any time any object in the query changes.There’s no other difference. The template will put the same thing on the screen and it will preserve the contents of form elements when it has to redraw itself.