I'm using mongodb c# diver in .net core application and having nested object with id field. I don't want to id serialized to _id in db documents. Instead of keep id in the db json.
public class MainClass
{
public string Id { get; set; }
public string Name { get; set; }
public NestedClass NestedClass { get; set; }
}
public class NestedClass
{
public string Id { get; set; }
public string Value { get; set; }
public string Description { get; set; }
}
In Db serialized as:
{
"_id": "89547bf9-e282-46f8-82e1-d29b3c07068e",
"name": "abc",
"nestedClass": {
"_id": "Some Text",
"Value": "value",
"Description": null
}
}
I need output some thing like:
{
"_id": "89547bf9-e282-46f8-82e1-d29b3c07068e",
"name": "abc",
"nestedClass": {
"id": "Some Text",
"Value": "value",
"Description": null
}
}
Views:
133
Total Answered:
1
Total Marked As Answer:
0
Posted On:
15-Feb-2023 06:00