Skip to content

SwiftBSON v3.0.0

Compare
Choose a tag to compare
@kmahar kmahar released this 12 Feb 20:00
· 32 commits to main since this release
8a9d60c

The MongoDB Swift driver team is pleased to announce the 3.0.0 release of SwiftBSON.

This release is technically a version 3.0 as this GitHub repository previously contained Swift bindings for libbson, a BSON library written in C. However, it is a 1.0 in spirit, as we have written a brand-new BSON library from scratch entirely in Swift.

While the internals are all new, this library provides the same familiar API as the C-based one that previously resided directly in our Swift driver’s codebase, with the addition of a couple new features:

  • We’ve added a new encoder/decoder pair, ExtendedJSONEncoder and ExtendedJSONDecoder, which support converting between your custom Swift types and extended JSON. See our new JSON Interop Guide for more details.
  • We’ve added a new method to BSONDocument, equalsIgnoreKeyOrder, which returns true if two documents contain the same (key, value) pairs in any order. See the documentation for more details.

The Swift driver will switch to using this library in our upcoming 1.1 release. You can view the full API documentation here.

A special thanks to @nbbeeken and @nspektor for their hard work on this library!

Included Tickets

Bug

  • [SWIFT-968] - Decimal128 parsing does not throw for error inputs
  • [SWIFT-971] - Overload of BSONEncoder.encode breaks type inference
  • [SWIFT-973] - Encoding top level arrays crashes
  • [SWIFT-999] - swift-bson is missing Timestamp initializer that takes in Ints
  • [SWIFT-1086] - equalsIgnoreKeyOrder respects key order in documents contained in arrays

New Feature

  • [SWIFT-915] - Port BSONEncoder and BSONDecoder to swift-bson
  • [SWIFT-916] - Implement JSON enum
  • [SWIFT-917] - Add sketch of ExtendedJSONDecoder public API
  • [SWIFT-918] - Implement JSON to BSON conversion
  • [SWIFT-920] - Support decoding from BSON in BSONDecoder
  • [SWIFT-921] - Implement ExtendedJSONDecoder's public API methods
  • [SWIFT-922] - Add sketch of ExtendedJSONEncoder's public API
  • [SWIFT-923] - Support encoding to a BSON in BSONEncoder
  • [SWIFT-924] - Implement extended JSON conversion methods
  • [SWIFT-925] - Implement ExtendedJSONEncoder's public API methods
  • [SWIFT-959] - Support userInfo in ExtendedJSONDecoder
  • [SWIFT-960] - Support outputFormatting options in ExtendedJSONEncoder
  • [SWIFT-1044] - Extended JSON generation performance improvements

Task

  • [SWIFT-400] - Improve evergreen test result output
  • [SWIFT-734] - Maintain multiple versions of the documentation
  • [SWIFT-837] - Set up repository and sketch out API
  • [SWIFT-838] - Copy over all BSON tests from the driver
  • [SWIFT-839] - Set up an Evergreen project for the library
  • [SWIFT-840] - Implement Decimal128 support
  • [SWIFT-841] - Add support for reading/writing Integer BSON types in documents
  • [SWIFT-843] - Make Document conform to Collection and Sequence
  • [SWIFT-844] - Implement ObjectId and ObjectIdGenerator
  • [SWIFT-845] - Add support for Array, Bool, String, Double, Date
  • [SWIFT-846] - Add support for RegularExpression, Symbol, Timestamp, and Binary
  • [SWIFT-847] - Implement DBPointer, Code, CodeWithScope
  • [SWIFT-848] - Update README
  • [SWIFT-914] - Setup Jazzy for Swift BSON
  • [SWIFT-919] - Support initializing BSON enum from extended JSON
  • [SWIFT-926] - Enable extended JSON BSON corpus tests
  • [SWIFT-930] - Implement existing extended JSON API
  • [SWIFT-935] - Run Swift API digester on driver before and after switching to new BSON library
  • [SWIFT-937] - Write a BSON release script
  • [SWIFT-1088] - Add ByteBuffer API to ExtendedJSONDecoder and ExtendedJSONEncoder

Improvement

  • [SWIFT-866] - Add validation to BSON construction
  • [SWIFT-867] - Make BSON Documents Mutable
  • [SWIFT-868] - Fill out DocumentIterator findByteRange and filter
  • [SWIFT-892] - Fix max BSON size limit to be Int32.max rather than server's default max BSON size
  • [SWIFT-893] - Add timestamp property to BSONObjectID
  • [SWIFT-939] - Add timestamp test with high-order bit set that's not 2^32-1
  • [SWIFT-941] - Add a bson corpus test with invalid type for $code when $scope is also present
  • [SWIFT-995] - Rename swift-bson target to SwiftBSON
  • [SWIFT-1016] - Implement an efficient method for pre-pending _ids in the new BSON library
  • [SWIFT-1026] - Extended JSON parsing performance improvements
  • [SWIFT-1064] - Use a struct instead of enum for ExtendedJSONEncoder.mode
  • [SWIFT-1070] - Improve performance of BSONDecoder
  • [SWIFT-1085] - Add more spec tests for invalid relaxed UUIDs