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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:15:45+00:00 2026-05-16T20:15:45+00:00

I am using Ruby code to calculate sum from the array returned by Mongoid.

  • 0

I am using Ruby code to calculate sum from the array returned by Mongoid.

But maybe using Map/Reduce can be faster, except I don’t see any docs for Map Reduce on mongoid.org and Google for

map reduce site:mongoid.org

doesn’t give any result either. (or using MapReduce or Map/Reduce)

There are docs on MongoDB’s site

map reduce site:mongodb.org

but need to use Map Reduce with Mongoid as well.

  • 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-16T20:15:45+00:00Added an answer on May 16, 2026 at 8:15 pm

    You can use map reduce with Mongoid just as you could through the Ruby driver directly:

    # Post is a Mongoid model...
    Post.collection.map_reduce(map_function, reduce_function, options)
    

    For some examples of doing map reduce in the Ruby driver, see this blog post by Kyle Banker (maintainer of the Ruby MongoDB driver).

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

Sidebar

Related Questions

Question: How can I document Ruby code using Doxygen? Disclaimer: I know ruby already
I'm using some ruby code wrapped in a begin - rescue block but somehow
I am using Ruby 1.8.6 for the following code: # Create an array and
Say you write some code like this (using ruby-mode, but I've seen this happen
I'm using named routes in my ruby code. I come from the phpworld where
How can I render javascript files containing ruby code (<%= ... %>) using Jammit?
I want retrieve the width and height of browser in pixel(px) using ruby code.
I am using the Mongo Ruby driver and have this block of Ruby code
I was trying to document some Ruby code using yard and even though I
I develop code using .net, and sometimes using ruby. My friend wants me to

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.