Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
2.21.0
-
None
-
None
-
Fully Compatible
-
Not Needed
-
Description
Summary
Driver Version: 2.21.0; No issue up to 2.20.0;
MongoDB Version: 6.0.10
When projecting a search result to the Id field of a nested document, the top-level Id field is returned.
See the following (simplified) example.
Expected: subDocumentId contains the value of the Id field of SubDocument.
Actual: subDocumentId contains the value of the Id field of Document.
Up to driver version 2.20.0, this works as expected.
public class BusinessLogic
{
public async Task<ObjectId> GetSubDocumentId()
}
public class Document
{ [BsonId] public ObjectId Id \{ get; set; } [BsonElement("Status")]
public string Status { get; set; }
[BsonElement("SubDocument")]
public SubDocument SubDocument { get; set; }
}
public class SubDocument
{ [BsonElement("Id")] public ObjectId Id \{ get; set; }}
Attachments
Issue Links
- is duplicated by
-
CSHARP-4806 V2.21.0 Projection issue
-
- Closed
-