node.js - MapReduce in keystone- giving error -
this mapreduce code nodejs works fine & perfect var server = new server('localhost', 27017, {auto_reconnect: true}); db = new db('test1', server); db.open(function(err, db) { if(err) console.log("connected 'driverb' database"); db.collection('users', function(err, collection) { var map = function() { emit(this.username.substr(this.username.indexof('@') + 1),1); }; var reduce = function(host, count) { return array.sum(count) ; }; collection.mapreduce(map, reduce, { out: "domain" }; } ); }); now wrote similar kind of code keystone throwing me error in next block. writing code part of upgrade migration script. var keystone = require('keystone'); var user = keystone.list('user'); exports = module.exports = func...