I'm trying to implement blog post storage using mongo db.
I've got two domain entities:
"Blog post" and "Author"
Currently I've added AuthorId property to blog post entity. Is that the right approach to store relation between objects?
I'm trying to implement blog post storage using mongo db.
I've got two domain entities:
"Blog post" and "Author"
Currently I've added AuthorId property to blog post entity. Is that the right approach to store relation between objects?
Currently I've added AuthorId property to blog post entity. Is that the right approach to store relation between objects?
I'd say no. You are "supposed" to store everything you need in a blog document in a denormalized way (e.g. the blog post, the comments, the tags, etc). So if you want to show the Author's name, you should add it to the blog document. This would allow to fetch an entire page's data with a single query, which is kinda the point of a document-oriented database.