Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
node.jsでmongooseを使っている際、純粋なgroup メソッドを利用する。
var mongoose = require("mongoose");
var DBName = "";
M.prototype.connection = mongoose.createConnection("mongodb://" + DBName, callback);
var database = M.connection.db
var collection = database.collection("datas");
// keys (object), condition (object), initial (object), reduce (function), finalize (function), [options] (object), callback{"id":true}, null, {}, function (curr, result) {
result._id = curr._id;
}, function(err, results){
if (err){
throw err;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment