如何在collectionA上的map/reduce的「地圖」部分內訪問collectionB中的數據?從地圖中的collectionB訪問數據/在collectionA上執行的縮小A
如果有幫助,我將短語存儲在collectionA中,我想要將每個短語分割成地圖中的單個單詞,然後從collectionB中獲取每個單詞的特定值。
在代碼中,我想到它會是這個樣子......
map = function() {
var key, value;
var results = db["collectionB"].find({something_related_to_collectionA});
results.forEach(function(result) {
// Change the value
});
emit(key, value);
};
reduce = function(key, values) {
// Perform the reduce
};
db["collectionA"].mapReduce(map, reduce, {out: "collectionC"});