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

Update NewDocument to take a variadic list of *Elements

    XMLWordPrintableJSON

Details

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

    Description

      Currently the NewDocument function takes a uint which is used as the initial capacity for the slices of the *Document. This was done primarily to enable users to allocate a single array upfront and then append to it later.

      Instead of doing it that way, update NewDocument to take a variadic list of *Elements. If a user wishes to control allocations, they can first make a []*Element, fill it with documents, and then pass that to NewDocument. In NewDocument we'll reuse the provided slice to ensure we don't allocate an extra array.

      For the majority of use cases, this change will enable a more concise creation of documents.

      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: