[GODRIVER-2133] Aggregate should not accept bson.D as a pipeline Created: 17/Aug/21 Updated: 28/Oct/23 Resolved: 01/Sep/21 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.7.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Divjot Arora (Inactive) | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation Changes: | Not Needed |
| Description |
|
Aggregate() functions currently accept bson.D as a valid value for the pipeline parameter but should not allow this because a bson.D is semantically a single document while a pipeline is an array of documents. This likely works internally because bson.D is implemented as a slice of bson.E, so it passes our "value is a slice" check in transformAggregatePipeline. We may have to special case bson.D and possibly other slice-based types like bson.Raw to prevent this. A reproducible example of this issue is here. |
| Comments |
| Comment by Githook User [ 01/Sep/21 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Githook User [ 01/Sep/21 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Benji Rewis (Inactive) [ 30/Aug/21 ] |
|
To preserve the existing behavior, we've decided to throw a more informative client-side error when a non-empty bson.D, bsoncore.Document or bson.Raw is passed as the pipeline parameter. Because the empty versions of those types behave "as expected", we won't stop the user from using them. |