-
Notifications
You must be signed in to change notification settings - Fork 67
SWIFT-631 Add BSON guide #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mbroadst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on this, I think it's very thorough. I have a few comments, mostly around deeply linking this document to other resources. I imagine a potentially frustrated user going through this will not want to have to open another window and search for some of these things we can link them to immediately. Make sure to use permalinks
kmahar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work, just a couple typo fixes and nits
Guides/BSON.md
Outdated
| ``` | ||
| This API provided a number of benefits, the principal one being the seamless integration of standard Swift types (e.g. `Int`) and driver custom ones (e.g `ObjectId`) into `Document`'s methods. It also had a few drawbacks, however. In order for `BSONValue` to be used as an existential type, it could not have `Self` or associated type requirements. This ended being a big restriction as it meant `BSONValue` could not be `Equatable`, `Hashable`, or `Codable`. Instead, all of this functionaltiy was put onto the separate wrapper type `AnyBSONValue`, which was used instead of an existential `BSONValue` in meany places in order to leverage these common protocol conformances. | ||
|
|
||
| Another drawback is that subdocuments lterals could not be inferred and had to be explicitly casted: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Another drawback is that subdocuments lterals could not be inferred and had to be explicitly casted: | |
| Another drawback is that subdocument literals could not be inferred and had to be explicitly casted: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
kmahar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two more typos lol, but otherwise LGTM, i don't need to re-review
| @@ -0,0 +1,429 @@ | |||
| # MongoSwift BSON Library | |||
| MongoDB stores and transmits data in the form of [BSON](bsonspec.org) documents, and MongoSwift provides a libary that can be used to work with such documents. The following is an example of some of the functionality provided as part of that: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| MongoDB stores and transmits data in the form of [BSON](bsonspec.org) documents, and MongoSwift provides a libary that can be used to work with such documents. The following is an example of some of the functionality provided as part of that: | |
| MongoDB stores and transmits data in the form of [BSON](bsonspec.org) documents, and MongoSwift provides a library that can be used to work with such documents. The following is an example of some of the functionality provided as part of that: |
oops, missed this one before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Guides/BSON.md
Outdated
| ``` | ||
| This API provided a number of benefits, the principal one being the seamless integration of standard Swift types (e.g. `Int`) and driver custom ones (e.g `ObjectId`) into `Document`'s methods. It also had a few drawbacks, however. In order for `BSONValue` to be used as an existential type, it could not have `Self` or associated type requirements. This ended being a big restriction as it meant `BSONValue` could not be `Equatable`, `Hashable`, or `Codable`. Instead, all of this functionaltiy was put onto the separate wrapper type `AnyBSONValue`, which was used instead of an existential `BSONValue` in many places in order to leverage these common protocol conformances. | ||
|
|
||
| Another drawback is that subdocument lterals could not be inferred and had to be explicitly casted: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Another drawback is that subdocument lterals could not be inferred and had to be explicitly casted: | |
| Another drawback is that subdocument literals could not be inferred and had to be explicitly casted: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
This PR adds a guide overviewing basic usage of the BSON library as well as a path for migration from the old one. Because we have examples and documentation already, I decided to keep it really basic. Let me know if you think it should have more meat to it or real examples.
Also, I included the migration guide here, but we could consider just putting it at the bottom of the release notes, seeing as we'll have to remove it at some point in the near future if we don't.