Blog implementation with MongoDB and NoRM: relationships?

I am starting to learn MongoDB using the NoRM C # driver in an ASP.NET MVC project. I'm just writing POCO classes right now and asking a question about how to implement the relationship between blog posts , comments and tags . I think I have a message and comment, but I'm not sure what to do with tags. In SQL, they are connected with many-to-many relationships, how would I implement something similar to MongoDB and NoRM?

These are my classes for posts and comments:

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; }
    }

The My Tag object is a question of how I can link the <==> message tags.

public class Tag
    {
        public ObjectId _id { get; set; }
        public string Name { get; set; }
    }

Thank.

+3
1

.

NoSql, . .

, : SQL Thing: -

+4

Source: https://habr.com/ru/post/1770939/


All Articles