Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

database - Best practice monogdb embed or not

I'm just starting using MongoDB and more used to relational DBs. I want to store users (id, name ...) in one collection and posts (id, title, content, userID) in another. At the frontend, I want to show the posts including the user, who posted them. Obviously the username and not a cryptic id. In a relation DB, I would join the tables and sent the combined object to the frontend.

But what would be the best approach for a Mongo DB? Should I include the username in the posts collection or also join the collections? I'm really unsure about the joins in Mongo since I heard it should be avoided.

Thanks for any help or suggestions!

question from:https://stackoverflow.com/questions/66067464/best-practice-monogdb-embed-or-not

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...