[GODRIVER-2232] bsoncore.Array not recognized as a valid type for aggregation pipelines Created: 15/Nov/21  Updated: 28/Oct/23  Resolved: 18/Nov/21

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0

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   

The transformAggregatePipeline function treats bsoncore.Array as a simple []byte and tries to marshal each value in the slice as a document, which fails. It should have a special case to recognize that bsoncore.Array actually represents a single BSON array. This gist repros the issue. Executing it fails with this error:

cannot transform type uint8 to a BSON Document: WriteInt32 can only write while positioned on a Element or Value but is positioned on a TopLevel



 Comments   
Comment by Githook User [ 17/Nov/21 ]

Author:

{'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}

Message: GODRIVER-2232 Allow bsoncore.Array as type for aggregation pipelines (#807)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/48ca24629ba874b6b64c3d460c446f71b72f9c2b

Comment by Benji Rewis (Inactive) [ 16/Nov/21 ]

Good catch! Here's a fix: https://github.com/mongodb/mongo-go-driver/pull/807

Generated at Thu Feb 08 08:38:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.