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

ReadConcern and WriteConcern should no longer wrap mongoc types

    XMLWordPrintable

    Details

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

      Description

      Currently ReadConcern wraps a mongoc_read_concern_t and WriteConcern wraps a mongoc_write_concern_t.

      However, in most places we use ReadConcern}}s and {{WriteConcern}}s , we never actually use the mongoc type for anything besides storing properties. We construct {{ReadConcern and WriteConcern documents ourselves which we insert into options documents. 

      The only places we actually need the mongoc types are when we set a {[ReadConcern}} or WriteConcern on a MongoClient, MongoDatabase, or MongoCollection

      We should think about no longer wrapping the mongoc types, and just adding e.g. withMongocReadConcern and withMongocWriteConcern helpers to use in those couple of places that temporarily constructs the equivalent libmongoc types. 

      This would allow us to make these types structs which seems more fitting and would cut down on any performance penalty from interop.

      We could also consider doing this for ReadPreference, though we actually do use the libmongoc types every time for those since they are separate arguments in the read helpers and not part of the options structs. 

        Attachments

          Activity

            People

            Assignee:
            nataly.carbonell Nataly Carbonell (Inactive)
            Reporter:
            kaitlin.mahar Kaitlin Mahar
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: