[GODRIVER-238] Lookup should properly traverse Arrays Created: 13/Feb/18  Updated: 28/Oct/23  Resolved: 23/Feb/18

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

Type: Bug Priority: Major - P3
Reporter: Kristofer Brandow (Inactive) Assignee: Samuel Rossi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The Document.Lookup method currently supports depth traversal. The implementation retrieves a document from an Array when it needs to traverse into a BSON Array, but the implementation of Arrays does not have the keys as numbered strings.

Since we currently just slice the first element off when doing a traversal, we'll need to add an internal method to Array (such as lookupTraverse) that takes an integer as the first parameter and a variadic slice of strings for the second argument, this way we can continue to traverse. This does mean that quite a bit of Lookup will be duplicated.



 Comments   
Comment by Githook User [ 23/Feb/18 ]

Author:

{'email': 'saghmrossi@gmail.com', 'name': 'Saghm Rossi', 'username': 'saghm'}

Message: GODRIVER-238 Implement proper array traversal for bson.Document.Lookup

Change-Id: I0c59b6d5df941b0d247e49b16c54b95fb1ff3b8a
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/17a7f3653814d3997fccccbeb79a511413e659d1

Comment by Samuel Rossi (Inactive) [ 23/Feb/18 ]

Code review url: https://review.gerrithub.io/c/401233/

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