Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 2个相关集合中的LiteDB查询_C#_Relationship_Bson_Dbref_Litedb - Fatal编程技术网

C# 2个相关集合中的LiteDB查询

C# 2个相关集合中的LiteDB查询,c#,relationship,bson,dbref,litedb,C#,Relationship,Bson,Dbref,Litedb,我有一个LiteDB数据库,包含2个POCO类 包含“Id”和“Name”作为属性的作者 包含“标题”Id”和“作者”(此属性具有 bson参考作者收藏) 我正在尝试查询图书集合,以便检索所有名为“John”的作者,他们写了一本或多本书 class Author // collection "authors" { [BsonId] public int id {get; set;} public string Name{get; set;} } clas

我有一个
LiteDB
数据库,包含2个POCO类

  • 包含“
    Id
    ”和“
    Name
    ”作为属性的作者
  • 包含“
    标题
    Id
    ”和“
    作者
    ”(此属性具有
    bson
    参考作者收藏)
我正在尝试查询图书集合,以便检索所有名为“
John
”的作者,他们写了一本或多本书

 class Author // collection "authors"
 {
     [BsonId]
     public int id {get; set;}
     public string Name{get; set;}
 }
 class Book //collection "books"
 {
     [BsonId]
     public int id {get; set;}
     public string Title{get; set;}
     [BsonRef("authors")] 
     public Author author {get; set;}
}
谢谢你的帮助

这里也解决了同样的问题。