-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Test and document that GridFSBucket.DownloadToStream is goroutine-safe
Context
Currently the Go Driver GridFSBucket.DownloadToStream method is goroutine-safe, but it's not documented or tested. We should test that GridFSBucket.DownloadToStream is goroutine-safe and say it's goroutine-safe in the documentation.
Definition of done
- Add a test that calls GridFSBucket.DownloadToStream in different goroutines and asserts that the uploaded results are correct.
- Also test GridFSBucket.DownloadToStreamByName with a similar test.
- Previous testing shows that those methods are likely already goroutine-safe.
- See a proof-of-concept test generated by Claude here.
- Update the documentation for GridFSBucket.DownloadToStream and GridFSBucket.DownloadToStreamByName to indicate they're safe to call from different goroutines. For example:
// It is safe for concurrent use by multiple goroutines.
Pitfalls
What should the implementer watch out for? What are the risks?