[SERVER-1085] slice doesn't work for nested arrays Created: 04/May/10 Updated: 12/Jul/16 Resolved: 05/May/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 1.5.1 |
| Fix Version/s: | 1.5.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Doug Hudson | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux 2.6.31-21-generic #59-Ubuntu SMP x86_64 GNU/Linux |
||
| Participants: |
| Description |
|
Performing slice on an array of arrays results in unexpected behavior. The returned slice is altering the elements. Examples: ) > db.slicetest.find({}, {items: {$slice: 1}}) { "_id" : ObjectId("4be05dbad9e167ecfebc17ce"), "items" : [ [ "a" ] ] }This one is correct: > db.slicetest.find({}, {items: {$slice: [1,1]}}) { "_id" : ObjectId("4be05dbad9e167ecfebc17ce"), "items" : [ [ 2 ] ] }> db.slicetest.find({}, {items: {$slice: [2,1]}}) { "_id" : ObjectId("4be05dbad9e167ecfebc17ce"), "items" : [ [ ] ] }> db.slicetest.find({}, {items: {$slice: [1,2]}}) { "_id" : ObjectId("4be05dbad9e167ecfebc17ce"), "items" : [ [ 2 ], [ 3 ] ] }Issue reported on mongo-user: |
| Comments |
| Comment by auto [ 05/May/10 ] |
|
Author: {'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}Message: Only $slice outer arrays when nested. |