[SERVER-18794] Add an aggregation expression to convert an object to an array of key, value pairs Created: 03/Jun/15 Updated: 19/Jul/17 Resolved: 03/Mar/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 3.4.4, 3.5.4 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Lee Chi Hang | Assignee: | Tess Avitabile (Inactive) |
| Resolution: | Done | Votes: | 15 |
| Labels: | expression, stage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backport Requested: |
v3.4
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Query 2017-03-06 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
| Comments |
| Comment by Githook User [ 28/Mar/17 ] |
|
Author: {u'username': u'sindbach', u'name': u'Wan Bachtiar', u'email': u'sindbach@gmail.com'}Message: Closes #1 Signed-off-by: Tess Avitabile <tess.avitabile@mongodb.com> |
| Comment by Tess Avitabile (Inactive) [ 08/Mar/17 ] |
|
Okay, thank you. It is fine to leave the commit message as is. Sorry for the mistake! |
| Comment by Wan Bachtiar [ 08/Mar/17 ] |
|
tess.avitabile correct. The pull-request was just on my fork https://github.com/sindbach/mongo, and not a pull-request on the https://github.com/mongodb/mongo |
| Comment by Tess Avitabile (Inactive) [ 07/Mar/17 ] |
|
wan.bachtiar, was there a pull request on the public repo, or just on your fork? I reviewed the one that was on your fork. |
| Comment by David Storch [ 03/Mar/17 ] |
|
tess.avitabile, what was the correct pull request number? We should ensure that it is linked to this ticket for future reference. |
| Comment by Tess Avitabile (Inactive) [ 03/Mar/17 ] |
|
Apologies, the pull request number in the commit message is incorrect. |
| Comment by Githook User [ 03/Mar/17 ] |
|
Author: {u'username': u'sindbach', u'name': u'Wan Bachtiar', u'email': u'sindbach@gmail.com'}Message: Closes #1 Signed-off-by: Tess Avitabile <tess.avitabile@mongodb.com> |
| Comment by Charlie Swanson [ 18/Jan/17 ] |
|
It has come to my attention that there is an open pull request to add this feature (thanks lch1990710!). This is great! I would love if someone from the community could help us out here. Unfortunately, we cannot accept it immediately. The syntax of the new expression in the pull request does not match the syntax proposed in the top of the description. More generally, we have not yet decided what the syntax of such an operator should be. I like the syntax of the new description since it allows manipulation of field names, and would open up several use cases (e.g. what are all the field names present in the collection?). This issue is high on the (tentative) list of expressions to add in the upcoming release, so we hope to meet up and agree on syntax in the coming months. I will check back in when we have agreed on a specification for this addition to the language, and hopefully we can revive the pull request at that point. |
| Comment by John A. De Goes [ 29/Mar/16 ] |
|
Awesome. Hope that means it gets on the roadmap, too. |
| Comment by Charlie Swanson [ 23/Mar/16 ] |
|
Hi all, After some internal discussion, we've decided that the best way forward is to add two expressions, along the lines of $objectToArray and $arrayToObject. I've converted this ticket to request the functionality of $objectToArray, and will file a separate ticket for $arrayToObject, then link that to this one. I believe this will cover all use cases, but some cases may require use of other expressions. |
| Comment by Lee Chi Hang [ 06/Jun/15 ] |
|
Ops, sorry for missing reading that haha, the idea seem similar, what od u think about which have a wider use case with other aggregate stage? Seem simply $objectToArray wilp be more user friendly. |
| Comment by Sylvain Leroux [X] [ 06/Jun/15 ] |
|
Oh, sorry for the confusion. Did you read my comment on server-11392 ? There are slightly different approaches to this idea. Worth taking time to discuss them, I think. |
| Comment by Lee Chi Hang [ 06/Jun/15 ] |
|
What I suggest in this ticket is add I function to convert object to array for example named it "$objectToArray" you may Google it after 3.1 release |
| Comment by Sylvain Leroux [X] [ 06/Jun/15 ] |
|
@Lee Chi Hang |
| Comment by Lee Chi Hang [ 06/Jun/15 ] |
|
I am thinking follow with $unwind is one of the use case of $objectToArray. |
| Comment by Sylvain Leroux [X] [ 06/Jun/15 ] |
|
Shouldn't be this ticket closed and consolidated with |
| Comment by Ramon Fernandez Marina [ 04/Jun/15 ] |
|
lch1990710, I've closed your pull request as it contained previous commits for other tickets. Please open a new pull request with just your changes for this feature request. Since your pull request is adding new functionality, it is strongly recommended that you add a test to check that this new functionality is working as expected. See for example the commit for the new $isArray operator as a recent example of what we expect in terms of testing for new features. Thanks, |
| Comment by Ramon Fernandez Marina [ 03/Jun/15 ] |
|
Thanks for you report lch1990710, we've set the fixversion to "Needs Triage" so this feature request is taken into consideration during the next planning round. Regards, |