[DOCS-11969] Examples given in '$reverseArray' documentation appear misleading Created: 15/Aug/18 Updated: 29/Oct/23 Resolved: 16/Aug/18 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Bradford (Inactive) | Assignee: | Kay Kim (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: | |
| Days since reply: | 5 years, 25 weeks, 6 days ago |
| Epic Link: | DOCSP-1769 |
| Description |
|
---------------------------- Original DescriptionI was looking into the '$reverseArray' aggregation expression found here: https://docs.mongodb.com/manual/reference/operator/aggregation/reverseArray/ Most of the examples given in the 'Example' section don't actually work when put in an aggregation. Because expressions treat their arguments as an array of arguments, when an array is given to '$reverseArray` it is treated like an argument list rather than a single argument. So in order to treat the argument as an array, it either needs to be wrapped in another array or the '$literal' expression needs to be included (The '$arrayToObject' expression uses this in its examples, https://docs.mongodb.com/manual/reference/operator/aggregation/arrayToObject/). Here is what I get when I attempt to run some of the examples in the shell:
And here are valid version of those expressions:
---------------------------- DescriptionScope of changes (files that need work and how much)Impact to other docs outside of this productMVP (work and date?)Resources (e.g. Scope Docs, Invision) |
| Comments |
| Comment by Githook User [ 16/Aug/18 ] |
|
Author: {'username': 'kay-kim', 'email': 'kay.kim@10gen.com', 'name': 'kay'}Message: |
| Comment by Githook User [ 16/Aug/18 ] |
|
Author: {'name': 'kay', 'email': 'kay.kim@10gen.com', 'username': 'kay-kim'}Message: |
| Comment by Githook User [ 16/Aug/18 ] |
|
Author: {'name': 'kay', 'email': 'kay.kim@10gen.com', 'username': 'kay-kim'}Message: |