[SERVER-27774] Add $of for iterating over object keys Created: 21/Jan/17 Updated: 06/Dec/22 Resolved: 26/Jan/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | daniel.morrison#1 | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
In many languages you have the ability iterate over objects in the same way as you iterate arrays. In ES6 the simple example is for...of where its equivalent for array is for...in https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of we already have $in for iterating our query across an array, could we add $of to do the same against objects in a document? |
| Comments |
| Comment by Charlie Swanson [ 26/Jan/17 ] | |||||||||||
|
Hi daniel.morrison, After reviewing your request, it seems like the requested functionality has already been requested in SERVER-267. If I understand the request correctly, implementing SERVER-267 would solve your problem. Because of this, I'm going to close this ticket as a duplicate. Please vote for SERVER-267 and watch it for further updates. If I missed something, and this is not actually a duplicate, please leave a comment describing the differences, and we can re-open the ticket. I would also like to point you to the related ticket Thank you for the request, | |||||||||||
| Comment by Kelsey Schubert [ 23/Jan/17 ] | |||||||||||
|
Hi daniel.morrison, Thanks for the clarifying examples. I'm sending this feature request to the Query Team for consideration. Kind regards, | |||||||||||
| Comment by daniel.morrison#1 [ 21/Jan/17 ] | |||||||||||
|
Equivalent in ES6
| |||||||||||
| Comment by daniel.morrison#1 [ 21/Jan/17 ] | |||||||||||
collection:
query:
result:
@ramon.fernandez does this look ok? | |||||||||||
| Comment by Ramon Fernandez Marina [ 21/Jan/17 ] | |||||||||||
|
Hi daniel.morrison, could you please provide a sample syntax for this new operator and further details of your use case? Thanks, |