In RavenDB, I have a document that looks like this:
public class SystemNotification {
public string Body {get;set;}
public List<Guid> ReadBy {get;set;}
}
How can I create an index to efficiently query for the count of unread notifications for a user ? Or is there a better way to model this scenario ?
Whether there is a better way to model this depends on how many users you will have in your system and a few other things.
As a side note: Don’t use Guids for your ids. They are hard to read and have no particular advantage over hilo keys.