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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:58:58+00:00 2026-06-03T03:58:58+00:00

New to Mongo, taking on the analytics quest and have a schema question. I’m

  • 0

New to Mongo, taking on the analytics quest and have a schema question.

I’m coming from SQL server, where I have 4 Tables…

stats_landing_table
-------------------
id
post_id
visit_date
country
browser
impressions

stats_geo_table
---------------
id
post_id
date
country
country_count

stats_browser_table
-------------------
id
post_id
date
browser
browser_count

stats_impressions_table
-----------------------
id
post_id
date
impression_count

With the landing table – I just throw all data into there each time – no updates, just inserts. On there I have a trigger that looks at the other tables and does the appropriate update or insert and then removes the entry fron the landing table.

So, I need FAST inserts/updates, with the ability to go back and display reports about each attribute around the post (country, browser, impressions, etc) based on a whole or on a particular timerange.

With Mongo, it comes down to whether I should embed or have separate documents, or I guess an entirely different schema. If I embed, I’m trying to figure out how I would update something like the browser table, while at the same time still checking for the country and updating impressions. It sounds like I would need a separate update for each thing (like, this vistor is using firefox from germany, while this one is firefox from finland – can’t do that in a single query from what I see). The other option is to do different documents, but that’s the same problem – I would need to do an update for each collection – that’s a lot of network traffic vs the SQL server single call.

I’m open to any suggestions of how to design something like this that allows for quick performance update/inserts, while still allowing reporting.

  • 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-03T03:58:58+00:00Added an answer on June 3, 2026 at 3:58 am

    from what I understand of this situation, the three tables are summary tables where the unique combination of day, post_id and the given metric in the case of browser or country are then tallied.

    I would skip the insert table all together as you don’t keep it today and use it more or less as a queue.

    With MongoDB the writes will all be written to memory so it is extremely fast. It can also be done asynchronously (fire and forget it style).

    I would create a new document for each unique date and post_id. It would have two arrays one for browsers and one for countries where the key is the country code or browser and the value is the count. The document would also have a field for impression count.

    Each visit would update a single document and would be easy to query.

    The update would use the atomic operator “$inc” to increment the counts atomically on the server so no data would need to be pulled in to do the update. It would be a very small amount of data to transfer.

    Does that answer the question?

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

Sidebar

Related Questions

I am new to Mongo DB I have to implement it in java. I
Here's my db: $db = new Mongo(mongodb://u:pw@server.com:37068/dbname); I want to echo a list/array of
Completely new to mongo here. I have following fields in on of my mysql
I wrote these lines in My Application start event: var mongo = new Mongo();
I am new to the mongo db.I just installed it over my ubuntu 11.04
I'm new to Mono and just started recently. Is mono program are compiled from
I need to run/develop a mono-based application on a new dedicated server, and the
Start server: bin\mongod.exe -dbpath=D:\mongo\dbs -rest -logpath=logs\server.log -logappend -noauth In java: Mongo mongo = new
I'm trying to execute this: <?php // connect $m = new Mongo(); ?> But
Ok i am using mongo db and have a repeating region on my page:

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.