Modeling and querying topic based updates subscriptions

19 views
Skip to first unread message

Maciek

unread,
May 7, 2012, 2:19:35 PM5/7/12
to ravendb
Just getting started with RavenDB (evaluating it for a small project
at work). Problem:

A user (subscriber) can subscribe (follow) topics. Updates are
published, each about one or more topics. What we want is an ability
to query for updates for a given subscriber based on his/her followed
topics. This is what I came up with:

class Subscriber
{
public string Id { get; set;}
public string[] FollowedTopics { get; set; }
}

class Update
{
public string Id { get; set; }
public string Title { get; set; }

// More irrelevant properties

public string[] Topics { get; set; }
}

Now I really don't know how to query this efficiently. MultiMap index?
Is the schema ok for the problem? Other suggestions?

Thanks,
Maciek

Oren Eini (Ayende Rahien)

unread,
May 7, 2012, 2:29:33 PM5/7/12
to rav...@googlegroups.com
session.Query<Update>().Where(x=>x.Topics.Any(x=>x.In(user. FollowedTopics  )).toList();

Should work
Reply all
Reply to author
Forward
0 new messages