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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:17:17+00:00 2026-05-30T08:17:17+00:00

I am relatively new to MongoDB, and so far am really impressed. I am

  • 0

I am relatively new to MongoDB, and so far am really impressed. I am struggling with the best way to setup my document stores though. I am trying to do some summary analytics using twitter data and I am not sure whether to put the tweets into the user document, or to keep those as a separate collection. It seems like putting the tweets inside the user model would quickly hit the limit with regards to size. If that is the case then what is a good way to be able to run MapReduce across a group of user’s tweets?

I hope I am not being too vague but I don’t want to get too specific and too far down the wrong path as far as setting up my domain model.

As I am sure you are all bored of hearing, I am used to RDB land where I would lay out my schema like

| USER |
--------
|ID
|Name
|Etc.

|TWEET__|
---------
|ID
|UserID
|Etc

It seems like the logical schema in Mongo would be

User
|-Tweet (0..3000)
  |-Entities
    |-Hashtags (0..10+)
    |-urls (0..5)
    |-user_mentions (0..12)
  |-GeoData (0..20)
|-somegroupID

but wouldn’t that quickly bloat the User document beyond capacity. But I would like to run analysis on tweets belonging to users with similar somegroupID. It conceptually makes sense to to the model layout as above, but at what point is that too unweildy? And what are viable alternatives?

  • 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-30T08:17:19+00:00Added an answer on May 30, 2026 at 8:17 am

    All credit to the fine folks at MongoHQ.com. My question was answered over on https://groups.google.com/d/msg/mongodb-user/OtEOD5Kt4sI/qQg68aJH4VIJ

    Chris Winslett @ MongoHQ


    You will find this video interesting:

    http://www.10gen.com/presentations/mongosv-2011/schema-design-at-scale

    Essentially, in one document, store one days of tweets for one
    person. The reasoning:

    • Querying typically consists of days and users

    Therefore, you can have the following index:

    {user_id: 1, date: 1} # Date needs to be last because you will range
    and sort on the date

    Have fun!

    Chris MongoHQ


    I think it makes the most sense to implement the following:

    user

    { user_id: 123123,
      screen_name: 'cledwyn',
      misc_bits: {...},
      groups: [123123_group_tall_people, 123123_group_techies, ],
      groups_in: [123123_group_tall_people]
    }
    

    tweet

    { tweet_id: 98798798798987987987987,
      user_id: 123123,
      tweet_date: 20120220,
      text: 'MongoDB is pretty sweet',
      misc_bits: {...},
      groups_in: [123123_group_tall_people]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to ruby and I'm trying to figure out the ruby way
Relatively new to JavaScript, so wondering what is the best approach to achive the
I'm relatively new javascript, but I am comfortable in other languages. I'm trying to
I'm relatively new to Java and I'm still trying to understand the fundamentals. I
Relatively new to JQuery. I've got some code that does a banner swap with
Hi I'm relatively new to Android programming but I would be grateful of some
I am a relatively new programmer so this may be a really simple question
I'm relatively new to MongoDB and having trouble with a more advanced upsert. I've
Relatively new to dealing with XML in jQuery. I am trying to retrieve a
Relatively new Windows Phone developer here, looking for some help. Basically I'm messing around

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.