Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Gone away
-
2.10.4
-
None
-
None
Description
var find = collection.Find(x => x.ArrayField.Any(predicate));
|
|
var a = find.Project<TypeOfX>(
|
Builders<TypeOfX>.Projection
|
.Include(x => x.ArrayField[-1]) |
.Exclude(x => x.Id)
|
)
|
.FirstOrDefault() // <-- OK |
?.ArrayField[0]; |
|
var b = find.Project(x => x.ArrayField[-1]) |
.FirstOrDefault(); // <-- MongoInternalException: Unexpected field |
Both a and b should be the same, but b throws an exception.
If FirstOrDefault() is replaced with ToString(), both queries are exactly the same. There is a bug in the projection object deserializer.