-
Notifications
You must be signed in to change notification settings - Fork 284
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
reimplement MongoCollection.find with projection #2694
Conversation
1507e08
to
f6dd9af
Compare
ac32582
to
10235f6
Compare
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.
Feel free to set auto-merge after the minors adjustments.
mongodb/vibe/db/mongo/collection.d
Outdated
@@ -376,6 +394,33 @@ struct MongoCollection { | |||
return MongoCursor!R(m_client, m_db.name, m_name, flags, num_skip, num_docs_per_chunk, query, returnFieldSelector); | |||
} | |||
|
|||
/** | |||
Queries the collection for existing documents, limitting what fields are |
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.
Typo: Limiting
|
||
See_Also: | ||
- Querying: $(LINK http://www.mongodb.org/display/DOCS/Querying) | ||
- Projection: $(LINK https://www.mongodb.com/docs/manual/tutorial/project-fields-from-query-results/#std-label-projections) |
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/vibe/db/mongo/collection.d
Outdated
@@ -80,7 +80,7 @@ struct MongoCollection { | |||
Throws: Exception if a DB communication error occurred. | |||
See_Also: $(LINK http://www.mongodb.org/display/DOCS/Updating) | |||
*/ | |||
deprecated("Use updateOne or updateMany taking UpdateOptions instead, this method breaks in MongoDB 5.1 and onwards.") | |||
deprecated("Use replaceOne, updateOne or updateMany taking UpdateOptions instead, this method breaks in MongoDB 5.1 and onwards.") |
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.
"Use `replaceOne`, `updateOne`, ..."
The frontend will then highlight it as it highlights keywords.
Thanks a lot for this, I think it'll make this module much more accessible! |
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 good apart from the get!T
behavior change.
Also tests it + fixed examples + fixed deprecations
Was dropped with MongoDB 5.1, retrieve errors directly from the command responses (implictly done by MongoDriverException) instead
10235f6
to
d50b7eb
Compare
adjusted to reviews |
d50b7eb
to
81cb943
Compare
CI is red |
Before, Bson values must have been of type long for get!long to work, now Bson values of type int also work with to!long. Additionally to!double now supports long and int as well. This is useful especially for MongoDB, where return types are not strictly specified.
81cb943
to
7803fc3
Compare
CI fixed |
Also tests it + fixed examples + fixed deprecations
Restores backwards compatibility with older code using returnFieldMapping. I noticed the old remove/update functions are always gonna still use the old behavior. We could in theory add compatibility layers there to let users just use the old API, but I would prefer users to upgrade to the better standardized API that's common across all drivers.