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

Improve Document.ElementAt usability

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.0.2
    • Affects Version/s: None
    • Component/s: None
    • None

      Currently, the Document type has 2 methods for looking up an element at an index: ElementAt and MustElementAt. Since they sort far apart and don't have the same prefix it is difficult for users to find. To enable a more discoverable API and to more closely align with the semantics of the slice type in Go, change ElementAt to just return the Element and panic if out of bounds, remove the MustElementAt method, and add an ElementAtOK method, which will return false if the index is out of bounds. This provides a safety option while also making the two methods more discoverable.

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: