充斥着聚合问题。 我认为,解决问题的最容易的方法是利用地图减少或单独发现问题,然后与作为同堂图书馆的帮助相处。
The schema is here:
db.keyword
keyword: String
start: Date
source: String(Only one of these (‘google’,’yahoo’,’bing’,’duckduckgo’) )
job: ref db.job
results: [
{
title: String
url: String
position: Number
}
]
db.job
name: String
keywords: [ String ]
urls: [ String ]
sources: [ String(‘google’,’yahoo’,’bing’,’duckduckgo’) ]
现在需要将数据输入这一表格:
data = {
categories: [ keyword1 , keyword2 , keyword3 ],
series: [
{
name: google ,
data: [33, 43, 22]
},
{
name: yahoo ,
data: [12, 5, 3]
}
]
}
Well the biggest problem is that the series[0].data array is made of really difficult find, matching the db.job.urls against the db.keyword.results.url and then get the position. Is there any way to simplify the query_? I have looked through many of the map reduce examples, but I cant find the correct way what data to map and which to reduce.