草庐IT

userCalculations

全部标签

javascript - MongoDB map-reduce(通过nodejs): How to include complex modules (with dependencies) in scopeObj?

我正在为mongodb数据库开发一个复杂的map-reduce过程。我已将一些更复杂的代码拆分为模块,然后通过将其包含在我的scopeObj中,使其可用于我的map/reduce/finalize函数,如下所示:constscopeObj={userCalculations:require('../lib/userCalculations')}functionmyMapFn(){letuserScore=userCalculations.overallScoreForUser(this)emit({'Key':this.userGroup},{'UserCount':1,'Score'

javascript - MongoDB map-reduce(通过nodejs): How to include complex modules (with dependencies) in scopeObj?

我正在为mongodb数据库开发一个复杂的map-reduce过程。我已将一些更复杂的代码拆分为模块,然后通过将其包含在我的scopeObj中,使其可用于我的map/reduce/finalize函数,如下所示:constscopeObj={userCalculations:require('../lib/userCalculations')}functionmyMapFn(){letuserScore=userCalculations.overallScoreForUser(this)emit({'Key':this.userGroup},{'UserCount':1,'Score'