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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:06:26+00:00 2026-05-17T01:06:26+00:00

For example, when doing Analytics, there can be a map/reduce run that takes 10

  • 0

For example, when doing Analytics, there can be a map/reduce run that takes 10 seconds. After it is run, if other webpages can make use of that result, then it will be saving 10 seconds per page.

It will be good to have the map/reduce result cached somehow.

It is possible to record a sucessful map/reduce run as map_reduce_result_[timestamp] in the db, and then keep this timestamp in db.run_log in MongoDB. This timestamp is the UNIX epoch time, for example. So when other pages need to access the result, they can get the max timestamp, and then just look up that result stored in MongoDB. But doing so is a little bit like a hack and wonder if there are better ways to do it.

  • 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-17T01:06:26+00:00Added an answer on May 17, 2026 at 1:06 am

    Your approach will save each map-reduce result in a separate collection. This is fine if you need to access these ‘historical’ results.

    If you’re only interested in the last result, you can use a single collection to act as a cache. You can specify the output collection of a map-reduce job using the out option.

    db.collection.mapReduce(map, reduce, { out: "cachedResult" });
    

    The permanent cachedResult collection will then contain the result.

    As you can read in the documentation, the map-reduce job will still use a temporary collection while executing. This temporary collection is atomically renamed to the output collection on completion. This means that you can safely rerun the map-reduce job using the same output collection, without having to worry about an invalid cache while map-reducing.

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

Sidebar

Related Questions

There is an example for doing this with Play! v2.0 but I'm trying to
Usually I was doing something like that (just a example): using (Stream xmlStream =
The Mongoid documentation only gives one example of doing a wildcard search: Person.where(first_name: /^d/i)
While doing the following simple example, I found the following difficulties As the title
I'm doing the HelloPoly example from the Stanford class and trying to disable the
I'm doing an ajax request through jQuery and for example, my URL is http://test.com/query.php?hello=foo
Here I am doing a basic trigger example but jquery is unable to execute
For example, if I'm doing some form input validation and I'm using the following
Here is the example of what I am doing: var size = new Array("S",
I'm doing an xpinc application. I followed the example in here and modified it.

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.