[SERVER-6149] $slice operator- skipping n elements from the end of an array where n > than array length doesn't return null values Created: 20/Jun/12 Updated: 06/Dec/22 Resolved: 05/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Jenna deBoisblanc | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 2 |
| Labels: | query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Query
|
||||
| Operating System: | ALL | ||||
| Participants: | |||||
| Description |
|
Consider the document: db.collection.find({}, {a : {$slice : [-10, 1]}}) returns whereas |
| Comments |
| Comment by David Storch [ 05/Jul/19 ] |
|
As far as I can tell, this is the correct behavior, so I'm going to close this ticket as Works as Designed. We interpret -10 to mean "start from the beginning of the array" when there are fewer than 10 array elements. |
| Comment by Rick Cotter [ 09/Aug/12 ] |
|
Especially important to enable viewing in reverse order:
|