reactive-table icon indicating copy to clipboard operation
reactive-table copied to clipboard

Error: Must use an ordered observe with skip or limit

Open dandv opened this issue 7 years ago • 1 comments

Getting this error when passing a function that returns a collection.find(..., { limit: X }) cursor to {{> reactiveTable collection=posts}}:

Exception in template helper: Error: Must use an ordered observe with skip or limit (i.e. 'addedBefore' for observeChanges or 'addedAt' for observe, instead of 'added').

Template.content.helpers({
  posts: function () {
    return Posts.find({}, {
      limit: 100,
    })
  }
});

dandv avatar Feb 24 '18 07:02 dandv

Interesting... reactive-table sets its own skip and limit based on rows per page, and in order to do that it converts the cursor to a collection by listening for changes, which I guess doesn't work when your cursor has a skip or limit already. I don't know how complicated it would be to switch to ordered observe like the error suggests.

If you only want 100 rows you might be fine using find().fetch() and passing in an array instead.

aslagle avatar Feb 26 '18 02:02 aslagle