Collection.FindOne panics on nil FindOneOptions.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 1.8.5
    • Affects Version/s: 1.8.4
    • Component/s: None
    • None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      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 (Inactive)
            Reporter:
            Faithfulness Alamu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: