Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2351

Collection.FindOne panics on nil FindOneOptions.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8.5
    • 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

      1. Create a collection.
      2. Create a list of options.FindOneOptions containing 1 nil options.FindOneOption.
      3. 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],]

            Assignee:
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Reporter:
            vaguemail369@gmail.com Faithfulness Alamu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: