admin管理员组文章数量:1336131
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 user4523328user45233281 Answer
Reset to default 11It'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();
本文标签: javascriptsort skip limit in Mongo MeteorStack Overflow
版权声明:本文标题:javascript - sort skip limit in Mongo Meteor - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742383438a2464552.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论