Skip to content

mongoose分页查询

Published: at 10:52 AM | 1 min read

PAGE_COUNT:每个页面的item数
page:当前页面标号

schema.find(query)
 
.skip(PAGE_COUNT * (page - 1))
 
.limit(PAGE_COUNT)
 
.sort({ _id: -1 })
 
.exec();