2

I have a LiteDB database with 2 POCO classes

  • Author that includes "Id" and "Name", as Properties
  • Book that includes "Title" "Id" and "Author"(this property has a bson reference to the Author's collection)

I'm trying to query the book collection in order to retrieve all authors named "John" that wrote one or more books.

 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;}
}

Thank you for the help

Adam
  • 2,726
  • 1
  • 9
  • 22
cese01
  • 21
  • 2

0 Answers0