0

I have following class where a Post can have many tags

public class Post
{
  public string Title {get;set;}
  public string Summary {get;set;}
  public List<string> Tags {get;set;}
}

I would like to get all the Posts grouped by tags if the a tag has at least 10 Post associated with it.

Is it possible to do it efficiently in LiteDB with the current class? I am open to ideas.

resp78
  • 1,414
  • 16
  • 37

1 Answers1

0

I'm not sure if this is what you need. But maybe your issue is than right now you have something like

var posts = db.GetCollection<Post>("Post");

Where var is of the type LiteCollection<Post> and you cannot work with that.

You may use .FindAll() or Find() to get an IEnumerable and with that use GroupBy to group however you want. 1

var groupedPost = posts.Find(p => p.Tags.Count > 10 ).GroupBy(*Group Condition*);
Sergio
  • 57
  • 2
  • 10