search

Home  >  Q&A  >  body text

mongodb mapreduce如何分页?

{mapreduce:"topic",
    query:{'time':{'$gte':1443715200}},
    map:function(){emit({name:this.name},this.clickNum);},
    reduce:function(clickNum,numbers){return Array.sum(numbers);},
    out:{inline:1}});

用上面的代码查询后一共有300条数据,这个时候如何对集合进行分页,比如一页20条

世界只因有你世界只因有你2772 days ago591

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-27 09:04:46

    out can be output to a certain collection, and then query and paginate the collection

    reply
    0
  • Cancelreply