0

I am trying to sub to a collection called items, but every time I try to sub with a limit or skip, it returns the whole collection because it thinks the params are undefined. For example, I am trying to render 1 item from the collection:

Meteor.subscribe("items", 1, 0);// 1 item, 0 skip
Tracker.autorun(() => {
  console.log(items.find({}).fetch());
})

When I do this, the entire collection gets printed. In the server, when I print the params of the publication:

Meteor.publish("items", (l, s) => {
  console.log(l, s);
  // returns: undefined undefined
  //          1 0   
  return items.find({}, {limit: l, skip: s});
})

And on the client side, I get all the documents rendered instead of just the one. Is there something I'm missing here or doing wrong???

user8813240
  • 125
  • 1
  • 7

1 Answers1

0

Most probably you still have the autopublish package installed, which automatically publishes and subscribes to your entire collection.

So it looks like you reach the step where you should remove that package (meteor remove autopublish).

Furthermore, on your Client, make sure you also filter the query on your collection, otherwise you may get polluted by parallel subscriptions that fill data into the same collection, as done with autopublish for example.

See also:

ghybs
  • 47,565
  • 6
  • 74
  • 99