Details
-
New Feature
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
Fully Compatible
Description
Some analytics queries can't be done by the aggregation framework only for the lack of an array size operator:
var a1 = db.runCommand({ aggregate:"track", pipeline:[
|
{$group: {
|
_id: "$urllower",
|
visits: {$sum: "$visits"},
|
kw: {$addToSet: "$kw"}
|
},
|
{$project: {
|
urllower: "$_id",
|
visits: 1,
|
keywords: {$size: "$kw"}
|
}
|
]});
|
The request here is for the $size operator at the end of the projection, which would give the size of the keyword array being built up here.
I choose $size for the name because we already use that for the same meaning here:
http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24size .
Attachments
Issue Links
- is depended on by
-
DOCS-1949 Document: aggregation: need an expression to give the size of an array in projections
-
- Closed
-
- is related to
-
SERVER-447 new aggregation framework
-
- Closed
-
- related to
-
SERVER-8582 Extend document expression language in aggregation to support advanced document filtering.
-
- Closed
-