Details
-
Bug
-
Resolution: Fixed
-
Unknown
-
2.14.0
-
None
Description
Tested with version 2.14.1 and LINQ provider V2.
Given the class:
public class TestClass |
{
|
[BsonElement("_p")] |
public string Property { get; set; } |
}
|
This query:
var queryable = collection.AsQueryable() .Select(x => new TestClass{ Property = x.Property.ToUpper() }); |
is handled correctly and produces the following MQL request:
{
|
"aggregate": "coll", |
"pipeline": [{ |
"$project": { |
"_p": { "$toUpper": "$_p" }, |
"_id": 0 } } ], |
"cursor": {} } |
While this query:
collection.Aggregate()
|
.Project(
|
Builders<TestClass>.Projection
|
.Expression(x => new TestClass { Property = x.Property.ToUpper() })); |
give the wrong query (still refers to attribute as Property:
{
|
"aggregate": "coll", |
"pipeline": [{ |
"$project": { |
"_p": { "$toUpper": "$_p" }, |
"_id": 0 } } ], |
"cursor": {} } |