We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
默认情况下mapreduce是无法使用外部变量的,当map或reduce等方法使用外部数据执行时,会报错找不到对象。
根据mongoose文档中可以看到scope参数,文档告知在执行期间暴露给map / reduce / finalize的{Object}作用域变量文档地址
var opt = {}; opt.scope = { userData: { position: 2, brand: 2 } }; opt.map = function() { emit("error", userData.position); }; opt.reduce = function(k, vals) { return vals.join(","); }; opt.out = { replace: "post_total" }; Role.mapReduce(opt, function(err, model) { if (err) { console.log(err); } else { model.model.find().exec(function(err, docs) { console.log(docs); }); } });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
默认情况下mapreduce是无法使用外部变量的,当map或reduce等方法使用外部数据执行时,会报错找不到对象。

根据mongoose文档中可以看到scope参数,文档告知在执行期间暴露给map / reduce / finalize的{Object}作用域变量文档地址
The text was updated successfully, but these errors were encountered: