[CSHARP-4244] Support object comparison at root level in LINQ3 Created: 08/Jul/22  Updated: 28/Oct/23  Resolved: 01/Nov/22

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

Type: Task Priority: Unknown
Reporter: Boris Dogadov 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-4369 Incorrect translation of Group/Where/... Closed
Related
is related to SERVER-71045 Use of $$ROOT in $expr in $match fail... Closed
Server Compat: 6.0
Backwards Compatibility: Fully Compatible

 Description   

Expressions like 

.where(p => p == person)

 should be supported.



 Comments   
Comment by Githook User [ 03/Nov/22 ]

Author:

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

Message: CSHARP-4244: Skip tests on older server versions due to server bugs.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/8f895935fc210944f34888294d93d4195908ffef

Comment by Robert Stam [ 02/Nov/22 ]

This feature currently only works on servers 6.0 and newer.

The symptom on older server versions is an error message containing the phrase "FieldPath::tail() called on single element path".

See SERVER-71045 to track the server issue if you intend to use this C# driver LINQ feature on older servers.

Comment by Githook User [ 01/Nov/22 ]

Author:

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

Message: CSHARP-4244: Support object comparison at root level in LINQ3.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/cdfbab2cd5a02bbd68d201675aed9a75aa7202b8

Comment by Robert Stam [ 27/Oct/22 ]

This ticket depends on the fix in CSHARP-4369 before it can be finished.

Comment by Robert Stam [ 27/Oct/22 ]

This looks like a valid LINQ query to me. It should translate to:

{ $match : { $expr : { $eq : ['$$ROOT', { <person> }] } } }

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