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

Improve Document.ElementAt usability

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 0.0.2
    • None
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: