[SERVER-4899] aggregation: need an expression to give the size of an array in projections Created: 07/Feb/12 Updated: 27/Oct/15 Resolved: 09/Sep/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.3 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Daniel Pasette (Inactive) | Assignee: | Matt Dannenberg |
| Resolution: | Done | Votes: | 21 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
Some analytics queries can't be done by the aggregation framework only for the lack of an array size operator:
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: |
| Comments |
| Comment by Asya Kamsky [ 15/Nov/13 ] | ||
|
Note, this cannot be used to determine if the field is an array. Just like $unwind, this operator will give an error if applied to a non-array. Possibly related: | ||
| Comment by auto [ 09/Sep/13 ] | ||
|
Author: {u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}Message: | ||
| Comment by Ryan Behan [ 26/Aug/13 ] | ||
|
+1 This would be very useful for our data. | ||
| Comment by David Henderson [ 23/Jul/13 ] | ||
|
This would be very useful - just coded an alternative using $unwind and it is slow. | ||
| Comment by Dan [ 17/Jun/13 ] | ||
|
+1 . Any reason there's no progress although this was coded a year ago? Doing $unwind can have a big performance hit for big arrays | ||
| Comment by Ajay Sabhaney [ 09/May/13 ] | ||
|
+1 | ||
| Comment by Bjørn Stachmann [ 07/May/13 ] | ||
|
+1 that would be extremely useful for analytics | ||
| Comment by Alvin Richards (Inactive) [ 20/Dec/12 ] | ||
|
The workaround would be to do the following right now
| ||
| Comment by Adam [ 05/Dec/12 ] | ||
|
+1 for this feature | ||
| Comment by Nicklas Overgaard [ 20/Nov/12 ] | ||
|
Hi, any reason this ticket is "stranded"? | ||
| Comment by Jared Rosoff [ 17/Feb/12 ] | ||
| Comment by Jared Rosoff [ 10/Feb/12 ] | ||
|
I have this in a branch ready to go when we want it merged. |