最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - sort skip limit in Mongo Meteor - Stack Overflow

programmeradmin0浏览0评论

I am using Meteor API for Mongo Collection to sort, skip and limit the records and return it to the client.

return CompanyData.find({},{sort:{overallrating:-1}},{skip:0,limit:30}).fetch();

But my above query is returning all the records that are present in the CompanyData Collection.

Does anybody know the reason?

I am using Meteor API for Mongo Collection to sort, skip and limit the records and return it to the client.

return CompanyData.find({},{sort:{overallrating:-1}},{skip:0,limit:30}).fetch();

But my above query is returning all the records that are present in the CompanyData Collection.

Does anybody know the reason?

Share Improve this question asked Jun 5, 2015 at 13:35 user4523328user4523328
Add a ment  | 

1 Answer 1

Reset to default 11

It's because the skip and limit options are included as a third argument in the find() method rather than the second parameter.

Re-write your query to this:

return CompanyData.find({}, {sort: {overallrating: -1}, skip: 0, limit: 30 }).fetch();
发布评论

评论列表(0)

  1. 暂无评论