Hi, I'm starting to learn MongoDB, using the NoRM C# driver in an ASP.NET MVC project. I'm just writing POCO classes right now, and have question on how to implement relationships between Blog Posts, Comments, and Tags. I think I have the Post & Comment, but not sure what to do on the Tags. In SQL, they are many-to-many relationship, how would I implements something similar with MongoDB & NoRM?
These are my classes for Post & Comment:
public class Post
{
public ObjectId _id { get; set; }
public string Title { get; set; }
public string Post { get; set; }
public string Uri { get; set; }
public DateTime Date { get; set; }
}
public class Comment
{
public ObjectId _id { get; set; }
public DbReference<Post> Post { get; set; }
public string Comments { get; set; }
public string Author { get; set; }
public string Email { get; set; }
public string Url { get; set; }
public DateTime Date { get; set; }
}
My Tag object is the one in question, how can I relate tags <==> posts.
public class Tag
{
public ObjectId _id { get; set; }
public string Name { get; set; }
}
Thanks.