Dear all My collections which have key is a array object. I need sum total as SQL statement: *Select Line_Items.Name , Sum(Line_Items.Quantity) from Orders group by Line_Items.Name* Could I use group to sum data instead of map/reduce? Please help me for this case ?
On Wednesday, September 12, 2012 5:19:37 PM UTC+7, Tom Vo wrote:
> Dear all > My collections which have key is a array object. > I need sum total as SQL statement: > *Select Line_Items.Name , Sum(Line_Items.Quantity) > from Orders group by Line_Items.Name* > Could I use group to sum data instead of map/reduce? > Please help me for this case ?
> My collections which have key is a array object. > I need sum total as SQL statement: > *Select Line_Items.Name , Sum(Line_Items.Quantity) > from Orders group by Line_Items.Name* > Could I use group to sum data instead of map/reduce?
Hi Tom,
You could use the Aggregation Framework in MongoDB 2.2 to sum the data by name:
stephen.stene...@10gen.com> wrote:
> My collections which have key is a array object.
>> I need sum total as SQL statement:
>> *Select Line_Items.Name , Sum(Line_Items.Quantity)
>> from Orders group by Line_Items.Name*
>> Could I use group to sum data instead of map/reduce?
> Hi Tom,
> You could use the Aggregation Framework in MongoDB 2.2 to sum the data by
> name:
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
--
Thanks and Best Regards
--------------------------------------------------------------------------- ----------------------------------
*Vo Tan Hau* (*TOM*)
*Senior Database Administrator*
NEXCEL SOLUTIONS LTD
*SMS Tower,Lot 40, Quang Trung Software City, District 12, HCMC, Vietnam.*
*Tel*:+84-8-37154278 *-* *Fax*:+84-8-37154279 www.nexcel.vn* Messenger *(*Skype+Yahoo+Live*): Vohau2002