I want to map an attribute from MongoDb to Id in the POCO class. Note that it is not the real _id in MongoDb, I wanted to use the name Id over something else.
The Mongo Object looks like
{
"_id": "string",
"OtherField": "string",
....
}
The Class looks like
class MyClass
[BsonElement("OtherField")]
public string Id { get; set;}
However, even though I used the [BsonElement] decorator, the Id still reflects the _id in the MongoDb. Is it not possible to do that?
Environment:
dotnet core 3.1
MongoDb.Driver 2.10.4