English 中文(简体)
从mongodb、地图或任何其他方式收集数据?
原标题:Aggregation the data from mongodb, map reduce or any other ways?

充斥着聚合问题。 我认为,解决问题的最容易的方法是利用地图减少或单独发现问题,然后与作为同堂图书馆的帮助相处。

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.

最佳回答

它看着你试图将两个单独收集的数据(关键词和工作)结合起来。

《减少地图》和新的《综合框架》只能在一次性收集的基础上运作。

您的最好之点可能是分别询问每项收集情况,并将结果与方案结合起来,以最适合您申请的方式加以节约。

If you would like to experiment with Map Reduce, here is a link to a blog post written by a user who used an incremental Map Reduce operation to combine values from two collections.
http://tebros.com/2011/07/using-mongodb-mapreduce-to-join-2-collections/

For more information on using Map Reduce with MongoDB, please see the Mongo Documentation: http://www.mongodb.org/display/DOCS/MapReduce (The section on incremental Map Reduce is here: http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-IncrementalMapreduce)

There are some additional Map Reduce examples in the MongoDB Cookbook: http://cookbook.mongodb.org/

关于如何开展“地图减少行动”的逐步行,请见MongoDB Cookbook recipe“Finding Max And Min Values with FCCC”

希望以上将给你一些想法,说明如何取得你所期望的成果。 正如我提到的那样,我认为最直截了当的解决办法只是将成果与方案结合起来。 然而,如果你成功地撰写了“减少行动”地图,请提出解决办法,使共同体能够从你的经验中受益。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签