James Crosswell
2013-06-17 10:53:16 UTC
I can run this query against the aggregation framework:
{
$group :{
_id : {"_id" : "$exists"},
quantity: {$sum: "$Quantity"},
sales: {$sum: { $multiply : ["$Quantity", "$Quantity" ] }}
}
}
But not this one:
{
$group :{
_id : {"_id" : "$exists"},
quantity: {$sum: "$Quantity"},
sales: {$sum: { $multiply : ["$Quantity", "$UnitPrice.Amount" ] }}
}
}
The only difference is the second argument to the multiply function... in
the second query this is a field of an embedded document.
Is this a bug or do I have to use a special syntax to work with embedded
fields?
Cheers,
James
--
--
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-/***@public.gmane.org
To unsubscribe from this group, send email to
mongodb-user+unsubscribe-/***@public.gmane.org
See also the IRC channel -- freenode.net#mongodb
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
{
$group :{
_id : {"_id" : "$exists"},
quantity: {$sum: "$Quantity"},
sales: {$sum: { $multiply : ["$Quantity", "$Quantity" ] }}
}
}
But not this one:
{
$group :{
_id : {"_id" : "$exists"},
quantity: {$sum: "$Quantity"},
sales: {$sum: { $multiply : ["$Quantity", "$UnitPrice.Amount" ] }}
}
}
The only difference is the second argument to the multiply function... in
the second query this is a field of an embedded document.
Is this a bug or do I have to use a special syntax to work with embedded
fields?
Cheers,
James
--
--
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-/***@public.gmane.org
To unsubscribe from this group, send email to
mongodb-user+unsubscribe-/***@public.gmane.org
See also the IRC channel -- freenode.net#mongodb
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.