How to use mongodb skip() and limit() in meteor?

Ramesh Murugesan picture Ramesh Murugesan · May 18, 2015 · Viewed 16.4k times · Source

How to use skip() and limit() in meteor?

Post.find({"user_id":user_id}).skip(0).limit(5);

when I execute above line server says

Exception while invoking method 'Userpost' TypeError: Object [object Object] has no method 'skip'

Answer

chridam picture chridam · Oct 14, 2015

You should try putting the skip and limit options as an object parameter within the find() method as follows:

Post.find({"user_id":user_id}, {skip: 0, limit: 5});