We are trying NOSQL Document database (ravenDB) and we are asking ourselves some questions. This is our models :
public class User
{
public Guid Id {get;set}
public string Name {get;set;}
}
public class Video
{
public Guid Id {get;set;}
public string Nom {get;set;}
public DateTime PublishDate {get;set;}
public User Publisher {get;set;}
public Uri Adress {get;set;}
}
By default, a video can not be read by anyone. You can add the rights to see the video at a user or a group of user. You can recommand a video to a user or a group of user(the rights to see the video is added automatically).
What is the best way to design the models for a NOSQL Document database considering the following use case :
- A user is publishing a video he can choose which group(s)/user(s) can see the video and recommend the video to some user(s)/group(s)
- A user withdraw the rights to see the video at some user(s)/group(s)
- Get the last N videos that a user has been authorized to read
- Get the last N videos that have been recommended for a user
We are considering the following :
- Add 2 List for each model (VideosReadable, VideosRecommended and UsersAllowedToRead, UserRecommended) where the first list contains all the elements of the second
- Add a list of Tuple for each model (
ListTuple<User, bool>>
andList<Tuple<Video, bool>>
), the bool indicates that if it is recommended. - Add a Document UserVideoLink
Which one would be the easiest model for querying ? Is there other better alternatives?