Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-160

Consider creating more Swift-y types for use in places where documents are passed in

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      MongoKitten provides an aggregation pipeline builder type that uses a system of enums to represent all the different components. this allows you to write pipelines in less error-prone ways since you know you'll get the stage, operator, etc. names right or it won't compile, and you don't have to wait for the server to complain about it. see blog post with example usage. seems way better than writing a bunch of nested documents. 

      this got me thinking that we should consider where providing those kinds of interfaces would be appropriate in the driver. for example, you could imagine creating some way to build an update document for a findAndModify command that only allows valid update operators. as long as the Swift types we provide are Codable, then it should be pretty easy to get them to document form in the end using the BsonEncoder.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            kaitlin.mahar Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: