Saturday, 15 March 2014

mongodb - Merging into large collections with Mongo -


I am trying to learn something to do with Mongo with a little success.

I am using an MARDus function, which I am working on, to increase the power consumption for a project. I have consolidated it in per account.

I have an hourly power of logging for each account in the collection, and I use a map reducing function which creates a collection that looks like this:

  {_id: (account_id) Value: {Wat: (The sum of all the watts in existence in other collection)}}   

I now use a map I also use that which is an incremental addition, instead of counting it every time, I might add.

What I need to know is how can I do rum so that I can use the watt for the current year, and put it in values ​​in each document. Of course I want to do it for every account.

I know that to collect data through the map, the reds, to create a document that look like:

  {_id: (account_id) value: {Watts_this_year: some_num}}   

I'm not sure how to collect it for collecting it.

I want to merge them to look like:

  {_id: (account_id) value: {watts_this_year: some_num, watt: (all in existence in other collections The sum of the watts)}}   

Am I clearly informed myself? Please tell me if there is anything then I can do to make my problem more clear.

Thank you!

MPradus is not for incremental updates. It is a shot tool for brainstorming a lot of data and results Returns I really advise you whether use of the aggregation structure is very fast to do this in real time. It is much faster than M / R. For example, your example above will be consolidated with the following call:

  db.collName.aggregate ({$ Group: {'_id': '$ _id', watt: {$ Sum: '$ watts'}}});   

A / FM / R is faster than it is implemented in C and can run concurrent jobs. At the moment there is a downward side that it does not present its results in a new collection, but it is currently being turned on:

No comments:

Post a Comment