aslagle / reactive-table

A reactive table designed for Meteor
https://atmospherejs.com/aslagle/reactive-table
Other
328 stars 138 forks source link

Error: Must use an ordered observe with skip or limit #486

Open dandv opened 6 years ago

dandv commented 6 years ago

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,
    })
  }
});
aslagle commented 6 years ago

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.