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

Consider improvement to typing for bulk write models

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The InsertOneModel and ReplaceOneModel structs for MongoCollection.bulkWrite() depend on the generic CollectionType. For consistency, all bulk write models are declared within the MongoCollection class. This requires either verbose syntax (e.g. MongoCollection<Document>.InsertOneModel) or type aliases like the following:

      private typealias DeleteOneModel = MongoCollection<Document>.DeleteOneModel
      private typealias DeleteManyModel = MongoCollection<Document>.DeleteManyModel
      private typealias InsertOneModel = MongoCollection<Document>.InsertOneModel
      private typealias ReplaceOneModel = MongoCollection<Document>.ReplaceOneModel
      private typealias UpdateOneModel = MongoCollection<Document>.UpdateOneModel
      private typealias UpdateManyModel = MongoCollection<Document>.UpdateManyModel
      

      We should investigate ways that this can be improved, and whether it is worth doing so.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jmikola Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: