Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:44:16+00:00 2026-05-23T13:44:16+00:00

I need to model a Q & A site like stackoverflow in mongoDB, here

  • 0

I need to model a Q & A site like stackoverflow in mongoDB, here are my main issues.

I have 2 main objects – Questions and users (just forget the others like answers etc…).

Users ask questions. I need to display the user with the question always. It is possible to search questions and browse all the questions. It safer to say that a user will ask less than 1000 questions.

Users have a reputation which is updated frequently and the current reputation should be shown with the question all the time.

Solution 1 : Embed the users inside the questions –

no need to perform a join but when the users reputation changes, all the relevant questions should be updated. And not easy to display single users

Solution 2 : Model users and question as separate collection (just like in RDBMS) –

now updating the reputation is not an issue BUT need to do a join between users and question every time a question is retrieved. Just like in RDBMS. Furthermore mongoDB doesn’t have joins and a join is actually 2 calls – 1 to get the question and another 1 to get the user, so if there are 100 questions to retrieve there’ll be 100 calls to get 100 separate users – NOT GOOD.

Soluion 3 : Embed the users inside the questions and have a separate collection for users too

When updating, update the user collection and the embedded users, when displaying only the user – use users

So which one should I use ? or else is this best solved with a RDBMS like MySQL ?. And how fast is the field updates in mongoDB ?

I’d love to use mongo because of its speed and easiness to route read requests to replicas and sharding (IF my site grew out of a single server which is unlikely anyway ;( )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:44:16+00:00Added an answer on May 23, 2026 at 1:44 pm

    Solution 1 sonunds for me like incompleted because in any way you should have storage of all users.

    Solution 2 Also can be a solution, and it’s will be probably better than any rdbms because in document database you can’t make a ‘real’ join and that’s means that you can easy scale your system.

    In case if you system will not so big like SO, just choose Solution #2.

    Solution 3 You no need embedd within question all user info, just embed information that you need to display.

    So best solution for high scalable system will be:

    Users – primary store of all user related info, in addition here you can have questions count, reputation, answers count and any statistic data you need

    Questions {ShortUserInfo {UserName, Reputation, GoldBadgetsCount, ...} } – store for questions with user related info that you need display

    Answers to particular question should be also embedded within question. And probably will also contais ShortUserInfo(or so).

    Solution #3 give you ability easy scale system and make it super fast. But when user update his profile(or reputation) you should update this information within each question/answer, but you can do this work async, in this case information can be stale for some time, but it’s okay. You can change your SO profile and see that your user name can be still old on some questions/answers.

    Hope this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have very simple problem. I need to create model, that represent element of
For example, if I have a user model and I need to validate login
I have a snippet to create a 'Like' button for our news site: <iframe
My site has two types of users; customers and suppliers. I have ended up
I have a Q&A type of site built in Django with the following models:
I have a Person model & an Item model. A person has many items,
I'm new here, working with Web Apps & SEO. StackOverflow has been a great
I have a model called note . I currently get notes like this: current_user.notes.order('date
I need to create a 3D model of a cube with a circular hole
I need to store some data in a Django model. These data are not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.