[CSHARP-4549] Support Tuple.Create and ValueTuple.Create in projections Created: 27/Feb/23  Updated: 28/Oct/23  Resolved: 22/Mar/23

Status: Closed
Project: C# Driver
Component/s: LINQ3
Affects Version/s: 2.19.0
Fix Version/s: 2.19.1

Type: New Feature Priority: Unknown
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CSHARP-4564 Write a custom serializer for ValueTu... Closed
is depended on by CSHARP-4548 IFindFluent.Projection fails with Exp... Closed
Backwards Compatibility: Minor Change
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Comments   
Comment by Githook User [ 24/Mar/23 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-4549: Better support for Tuples and ValueTuples in LINQ3.
Branch: v2.19.x
https://github.com/mongodb/mongo-csharp-driver/commit/5e27219635d7cc731a9643147969e86af9710b0d

Comment by Githook User [ 22/Mar/23 ]

Author:

{'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}

Message: CSHARP-4549: Better support for Tuples and ValueTuples in LINQ3.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/5ee839efa81d66e8c27c6eecf16133afd6caea8a

Comment by Robert Stam [ 15/Mar/23 ]

Thank you for reporting this.

It ended being a bit of an overhaul of Tuple support in LINQ in general, not just adding support for the Create methods.

The main change is that Tuples (as well as ValueTuples) are now serialized as arrays in LINQ the same way a Tuple property of a POCO would have been serialized.

That also meant that tuple item references like `tuple.Item<n>` had to be translated to either `tuple.<n>` (in filters) or `

{ $arrayElemAt :  ["$tuple", <n>] }

` (in aggregation expressions).

Generated at Wed Feb 07 21:48:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.