-
Notifications
You must be signed in to change notification settings - Fork 25
DOCSP-49876: Add IBsonReader and IBsonWriter info #641
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
DOCSP-49876: Add IBsonReader and IBsonWriter info #641
Conversation
✅ Deploy Preview for docs-csharp ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
do you know what this file is?
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.
Hm, strange – I think I created that file when I was thinking of taking the ConnectionString task that you ended up grabbing.
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.
looks great w/ 1 question
source/data-formats/bson.txt
Outdated
@@ -212,6 +216,41 @@ BSON document stored in ``myFile.bson``: | |||
``System.IO.Stream`` object. This means that you can read or write any location | |||
that can be accessed by a stream. | |||
|
|||
Implement a Custom BSON Reader and Writer |
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.
I don't think any user would (or should) ever want to implement a custom IBsonReader
or IBsonWriter
.
If we want to document anything at all about these interfaces it should be:
- That
IBsonReader
/IBsonWriter
interfaces can be used to read "documents" represented in several formats - The we have readers and writers for 3 formats: BSON, JSON and in-memory
BsonDocument
The three sets of standard readers and writers are:
BsonBinaryReader
andBsonBinaryWriter
JsonReader
andJsonWriter
BsonDocumentReader
andBsonDocumentWriter
They all implement the same interfaces.
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.
Will take another crack at this section!
source/data-formats/bson.txt
Outdated
``BsonBinaryReader`` and ``BsonBinaryWriter`` classes. However, you can also implement a | ||
custom reader and writer by implementing the | ||
``IBsonReader`` and ``IBsonWriter`` interfaces. This is useful when you want to define | ||
a custom serializer or if you want to directly read or write BSON or JSON data without |
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.
While writing a custom serializer is an expected (if rare) thing for a user to do, there is no need for custom readers and writers.
Custom serializers use the standard reader and writer interfaces to Deserialize
and Serialize
values.
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.
LGTM
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.
LGTM + 1 change
source/data-formats/bson.txt
Outdated
- ``JsonReader`` and ``JsonWriter``: Read and write JSON data. | ||
- ``BsonDocumentReader`` and ``BsonDocumentWriter``: Read and write BSON data | ||
contained in a ``BsonDocument`` object. |
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.
- ``JsonReader`` and ``JsonWriter``: Read and write JSON data. | |
- ``BsonDocumentReader`` and ``BsonDocumentWriter``: Read and write BSON data | |
contained in a ``BsonDocument`` object. | |
- ``JsonReader`` and ``JsonWriter``: Read and write JSON data | |
- ``BsonDocumentReader`` and ``BsonDocumentWriter``: Read and write BSON data | |
contained in a ``BsonDocument`` object |
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-49876
Staging Links
Self-Review Checklist