1. //前端处理
    2. http://localhost:8080/top250?start=0&count=5;
    3. start-->为下标
    4. count-->为限制
    1. //limit(2) 只会获取两条数据
    2. db.top250.find().limit(2)
    3. //skip() 下标
    4. db.top250.find().skip(1).limit(2)
    1. router.get("/top250",async ctx =>{
    2. var {start,count} = ctx.query
    3. console.log(ctx.query);
    4. if(start == undefined){
    5. start=0
    6. }
    7. if(count==undefined){
    8. count=5
    9. }
    10. var data = await Top250Model.find({}).skip(Number(start)).limit(Number(count))
    11. ctx.body = {
    12. data,
    13. code:200
    14. }
    15. })