小编And*_*rzo的帖子

如何在c#foreach循环中使用MongoDB的Query和QueryBuilder?

我正在尝试查询我的收藏品,但我不确定如何对其进行"追加" Query.And()

这是我创建Item文档的域模型:

public class Item
{
    public ObjectId Id { get; set; }
    public string ItemTypeTemplate { get; set; }
    public string UsernameOwner { get; set; }

    public IList<ItemAttribute> Attributes { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

IList<ItemAttribute>根据收集的变化ItemTypeTemplate(某种查找关键项目的属性预先确定的名单)

以下是Item文档示例:

{
    "_id" : ObjectId("5130f9a677e23b11503fee72"),
    "ItemTypeTemplate" : "Tablet Screens", 
         //can be other types like "Batteries", etc.
         //which would change the attributes list and values
    "UsernameOwner" : "user032186511",
     "Attributes" : [{
         "AttributeName" : "Screen Size",
         "AttributeValue" …
Run Code Online (Sandbox Code Playgroud)

c# mongodb mongodb-.net-driver

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

mongodb ×1

mongodb-.net-driver ×1