Skip to content

Conversation

@patrickfreed
Copy link
Contributor

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.

Copy link
Member

@mbroadst mbroadst left a 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

Copy link
Contributor

@kmahar kmahar left a 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@kmahar kmahar left a 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Contributor Author

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@patrickfreed patrickfreed merged commit 45a6f44 into master Nov 6, 2019
@patrickfreed patrickfreed deleted the SWIFT-631/bson-guide branch November 6, 2019 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants