mongodb runcommand group使用方法

时间:2014-09-19 10:01:45   收藏:0   阅读:1002

db.runCommand(

{

  group:

  {

    ns:"testc",

    key:{name:null},

    initial:{num:0},

   $reduce:function(doc,prev)

   {

      prev.num++;

  }

 }

}

)

 

{

   "retval":[

      {

       "name":"sulin",

      "num":1

   }

  ,

   {

    "name":"lihui",

   "num":1

   }

],

    "count":2,

   "keys":2,

   "ok":1

}

)

}

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!