-
Notifications
You must be signed in to change notification settings - Fork 21
DOCSP-39852: Fluent API #118
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
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, awesome work on this hefty PR - lmk if you want me to take another look after fixing small errors
chaining option builder functions one at a time. | ||
.. note:: Setting Options | ||
|
||
Beginning in {+driver-short+} v3.0, you can set ``FineOneAndDeleteOptions`` fields by |
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.
S: since this change will only appear in v3 docs, no need to specify the version
Beginning in {+driver-short+} v3.0, you can set ``FineOneAndDeleteOptions`` fields by | |
You can set ``FindOneAndDeleteOptions`` fields by |
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 noticed this typo in other places as well, maybe Ctrl F to make sure it's spelled correctly everywhere
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.
oops fixed!
|
||
The following table describes the options available in | ||
``FineOneAndDeleteOptions``: | ||
``FineOneAndUpdateOptions``: |
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.
``FineOneAndUpdateOptions``: | |
``FindOneAndUpdateOptions``: |
|
||
The following table describes the options available in | ||
``FindOneAndReplaceOptions``: | ||
``FineOneAndReplaceOptions``: |
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.
``FineOneAndReplaceOptions``: | |
``FindOneAndReplaceOptions``: |
creation of many different types, including ``FindOptions``. You can | ||
use each type's ``builder()`` method to construct an options instance | ||
by chaining option builder functions one at a time. | ||
Beginning in {+driver-short+} v3.0, you can set ``FindOptions`` fields by chaining |
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.
Same comment as earlier - remove
@@ -283,7 +288,7 @@ collection: | |||
{ "_id": 3, "title": "Goodnight Moon" } | |||
|
|||
When you attempt to insert these documents, the result depends on the | |||
value of the ``ordered`` option in your ``InsertManyOptions``: | |||
``ordered`` value passed to the ``ordered()`` option builder method: |
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.
``ordered`` value passed to the ``ordered()`` option builder method: | |
value passed to the ``ordered()`` option builder method: |
creation of many different types, including ``GridFsBucketOptions``. You | ||
can use the ``builder()`` method to construct an instance of each type | ||
creation of some struct types, including ``GridFsBucketOptions``. You can | ||
use the ``builder()`` method to construct an instance of each type |
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.
Q: just checking that the gridFS api is still using builders to create options
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.
Yes it is
let filter = doc! { "year": 2015 }; | ||
let mut cursor = collection.find(filter, opts).await?; | ||
let mut cursor = collection |
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.
Q: with all these line changes, can you check that theres no code highlighting that was affected?
source/faq.txt
Outdated
@@ -134,7 +134,7 @@ and using the ``try_next()`` method to iterate over ``Actor`` instances causes a | |||
// Add setup code here | |||
|
|||
let my_coll: Collection<Actor> = client.database("db").collection("actors"); | |||
let mut cursor = my_coll.find(None, None).await?; | |||
let mut cursor = my_coll.find(None).await?; |
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.
let mut cursor = my_coll.find(None).await?; | |
let mut cursor = my_coll.find(doc! {}).await?; |
doc! { "title": "Peter Pan" }, | ||
None | ||
)?; | ||
let result = collection.find_one(doc! { "title": "Peter Pan" })?; |
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.
Unfortunately, for the sync API the switch to fluent methods means they now need a .run()
to execute; there's no natural terminator like .await
is for the async API. So this becomes:
let result = collection.find_one(doc! { "title": "Peter Pan" }).run()?;
and similar for other places below.
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!
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-39852
Staging - https://preview-mongodbnorareidy.gatsbyjs.io/rust/DOCSP-39852-fluent-api/
Self-Review Checklist