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 8328611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:30:00+00:00 2026-06-09T01:30:00+00:00

I am just experimenting with mongodb/redis for work. I am considering this scenario, assume

  • 0

I am just experimenting with mongodb/redis for work. I am considering this scenario, assume a blog for example.

I plan on doing the following queries, primarily:

  1. List posts by a specifc user
  2. List comments by a specific user
  3. List posts based on a specific category
  4. View a single post and its comments

Note: Redis is used to store userid<->username mapping.

Is this a good/flexible schema design? The future plan say would be to add post/comment rating.

Post

  • _id
  • author (db-ref: user._id; index)
  • content
  • category (index)

User

  • _id
  • username (unique index)
  • passwordhash

Comments

  • _id
  • post (db-ref: post._id; index)
  • author (db-ref: author._id; index)

adding Rating/votes

Post

  • _id
  • author (db-ref: user._id; index)
  • content
  • category (index)
  • votes (number)

User

  • _id
  • username (unique index)
  • passwordhash

Comments

  • _id
  • post (db-ref: post._id; index)
  • author (db-ref: author._id; index)
  • votes (number)

CommentVotes

  • _id = author.Id (key)
  • voted: [comment._id, comment._id, …]

PostVotes

  • _id = author.Id (key)
  • voted: [post._id, post._id]

What do you think? Or am I just nuts?

  • 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-06-09T01:30:01+00:00Added an answer on June 9, 2026 at 1:30 am

    I think you’re still thinking relationally. I like to think of document data objects as Russian dolls with links (threads?) that can link one doll to another. In your case:

    • Users doll
      • Username
      • Email
      • PasswordHash
      • PostUpvotes (list of Post IDs)
      • CommentUpvotes (list of Comment IDs)
    • Posts doll
      • Comments doll (list of comments)
        • Comment
          • User ID
          • Username
          • TotalVotes (int)
          • Comment ID
      • TotalVotes (int)
      • Category IDs (list) (surely a post can have more than one?)
      • Author ID
    • Categories Doll

    You might want to put the votes on comments and posts into the user object then use map/reduce to get the counts every 15 mins or so (this is the ‘canonical’ use of a map/reduce). The important thing about upvotes is that a User doesn’t get to do them twice, so keeping them in the User object makes more sense (no hitting of an index to see if the User has voted on a post already). Since the actual number of upvotes per Post isn’t as critical, it can be kept in the Post and updated periodically.

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

Sidebar

Related Questions

im just experimenting with Android + Java. Im following this guide: http://developer.android.com/training/basics/firstapp/index.html Did everything
I was just experimenting and tried putting this in the console: 4 | 2
I was just experimenting and ended up with the following snippet: public static class
I am just experimenting with the references using this code: class A { };
I'm just experimenting with Optimistic locking. I have the following class: @Entity public class
Just experimenting I've used this query on MySQL: insert into table_name (text_col) values (1919191919191919191919191...91919191)
I am just experimenting on Mutex and wrote the following code. using System; using
I'm just experimenting with boost::pool to see if its a faster allocator for stuff
I just started experimenting with Aptana Jaxer server side javascript engine for my next
I've just been experimenting with the boost::function_types library recently, and I've come across a

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.