-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 1.8.4
-
Component/s: None
-
None
-
Not Needed
Summary
The FindOne method on a Collection panics due to nil pointer dereference on a nil FindOneOption.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
Problem initially discovered on v1.8.2 installation but is observed to persist in MongoDB Driver version v1.8.4.
How to Reproduce
- Create a collection.
- Create a list of options.FindOneOptions containing 1 nil options.FindOneOption.
- Pass the list to collection.FindOne
Additional Background
Dereferencing a nil FindOneOption results in a panic. Please see https://github.com/mongodb/mongo-go-driver/blob/630ff7cbfd2363b49bfa48968b80ce287e70ae85/mongo/collection.go#L1315|https://github.com/mongodb/mongo-go-driver/blob/630ff7cbfd2363b49bfa48968b80ce287e70ae85/mongo/collection.go#L1315],]