mongodb驱动程序c#更新嵌套对象数组中的一个字段
public class Country
{
public string Id { get; set; }
public string Name { get; set; }
public List<State> States { get; set; }
}
public class State
{
public string Name { get; set; }
public List<District> Districts { get; set; }
}
public class District
{
public string Name { get; set; }
public string Population { get; set; }
}
给定区名称,州名称,国家ID和新人口,我如何更新单个地区的人口。使用linq和mongodbdriver?
public class Country
{
public string Id { get; set; }
public string Name { get; set; }
public List<State> States { get; set; }
}
public class State
{
public string Name { get; set; }
public List<District> Districts { get; set; }
}
public class District
{
public string Name { get; set; }
public string Population { get; set; }
}
How can I Update Population of a single District, given District Name ,State Name, Country Id and New Population. Using LinQ and MongoDBDriver?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的完整示例
https://github.com/iso8859/learn-mongodb-by-example/blob/main/main/dotnet/01%20-20-%20Begin/10%20%20-%20updatenestedarray.cs
Full example here
https://github.com/iso8859/learn-mongodb-by-example/blob/main/dotnet/01%20-%20Begin/10%20-%20UpdateNestedArray.cs