-
Notifications
You must be signed in to change notification settings - Fork 21
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-43911 - Implicit Client-Side Projection #242
Merged
mongoKart
merged 8 commits into
mongodb:v3.0
from
mongoKart:docsp-43911-client-projection
Oct 3, 2024
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
617c38a
first draft
mongoKart 1b12da7
Merge remote-tracking branch 'upstream/v3.0' into docsp-43911-client-…
mongoKart f8e0179
feedback
mongoKart 7c5003d
Merge remote-tracking branch 'upstream/v3.0' into docsp-43911-client-…
mongoKart ab63a51
fix
mongoKart 995ca45
clarify
mongoKart 5eb9f40
feedback
mongoKart 2b6bd0a
remove select method
mongoKart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,77 @@ The 3.0 driver release includes the following new features: | |
`TimeOnly Struct. <https://learn.microsoft.com/en-us/dotnet/api/system.timeonly?view=net-6.0>`__ | ||
API reference page on MSDN. | ||
|
||
- Adds support for implicit client-side projection when using the ``Find()`` method, | ||
the ``Select()`` method, or the ``Project()`` aggregation stage with the LINQ3 provider. | ||
In previous versions of the driver, you could perform client-side | ||
projection with the LINQ3 provider only after calling the ``ToEnumerable()`` or | ||
``AsEnumerable()`` method, and only within the ``Select()`` method. | ||
|
||
To learn how to enable and use client-side projection for a driver method, select the | ||
corresponding tab: | ||
|
||
.. tabs:: | ||
|
||
.. tab:: Find() Method | ||
:tabid: find-method | ||
|
||
.. code-block:: csharp | ||
|
||
// Enable client-side projection | ||
var findOptions = new FindOptions(); | ||
findOptions.TranslationOptions = new ExpressionTranslationOptions | ||
{ | ||
EnableClientSideProjections = true | ||
}; | ||
|
||
var find = collection | ||
.Find(doc => doc.Id == 1, findOptions); | ||
.Project(doc => new { R = MyFunction(doc.Name) }); | ||
|
||
.. tab:: Select() Method | ||
:tabid: select-method | ||
|
||
.. code-block:: csharp | ||
|
||
// Enable client-side projection | ||
var aggregateOptions = new AggregateOptions(); | ||
aggregateOptions.TranslationOptions = new ExpressionTranslationOptions | ||
{ | ||
EnableClientSideProjections = true | ||
}; | ||
|
||
var queryable = collection | ||
.AsQueryable(aggregateOptions) | ||
.Where(doc => doc.Id == 1) | ||
.Select(doc => new { R = MyFunction(doc.Name) }); | ||
|
||
.. tab:: Project() Method | ||
:tabid: project-method | ||
|
||
.. code-block:: csharp | ||
|
||
// Enable client-side projection | ||
var aggregateOptions = new AggregateOptions(); | ||
aggregateOptions.TranslationOptions = new ExpressionTranslationOptions | ||
{ | ||
EnableClientSideProjections = true | ||
}; | ||
|
||
var aggregate = collection | ||
.Aggregate(aggregateOptions) | ||
.Project(doc => new { R = MyFunction(doc.Name) }); | ||
|
||
.. tip:: MongoClientSettings | ||
|
||
To enable client-side projection for all queries on a client, set the | ||
``TranslationOptions`` property of the ``MongoClientSettings`` object to ``true``. | ||
|
||
To learn more about using the aggregation pipeline with the {+driver-short+}, see | ||
:ref:`csharp-aggregation`. | ||
|
||
For more information about this release, see the :github:`v3.0 release notes | ||
</mongodb/mongo-csharp-driver/releases/tag/v3.0.0>`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link will be broken until actual release. |
||
|
||
.. _csharp-version-2.28: | ||
|
||
What's New in 2.28 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why would this be the case? Once you're client-side you can do anything.
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 suspect I inferred this from something in the Jira ticket.