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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:47:15+00:00 2026-06-12T11:47:15+00:00

I have a map-reduce query that works and does what I want however I

  • 0

I have a map-reduce query that “works” and does what I want however I have so far spectacularly failed to make use of my output data because I cannot workout how to read it back… let me explain… here is my emit:

emit( { jobid: this.job_id, type: this.type}, { count: 1 })

and the reduce function:

reduce: function (key, values) {
    var total = 0;
    for( i = 0; i < values.length; i++ ) {
        total += values[i].count;
    }
    return { jobid: this.job_id, type:this.type, count: total};
},

It functions and the output I get in the results collection looks like this:

{ "_id" : { "jobid" : "5051ef142a120", "type" : 3 }, "value" : { "count" : 1 } }
{ "_id" : { "jobid" : "5051ef142a120", "type" : 5 }, "value" : { "count" : 43 } }
{ "_id" : { "jobid" : "5051f1a9d5442", "type" : 2 }, "value" : { "count" : 1 } }
{ "_id" : { "jobid" : "5051f1a9d5442", "type" : 3 }, "value" : { "count" : 1 } }
{ "_id" : { "jobid" : "5051f299340b1", "type" : 2 }, "value" : { "count" : 1 } }
{ "_id" : { "jobid" : "5051f299340b1", "type" : 3 }, "value" : { "count" : 1 } }

BUT HOW the hell do I issue a query that says find me all jobid entries by “jobid” whilst ignoring the type? I tried this intiailly, expecting two rows of output but got none!

db.mrtest.find( { "_id": { "jobid" : "5051f299340b1" }} );

I have also tried and failed with:

db.mrtest.find( { "_id": { "jobid" : "5051f299340b1" }} );

and whilst:

db.mrtest.find( { "_id" : { "jobid" : "5051f299340b1", "type" : 2 }} )

does produce one row of output as hoped for, changing it to this again fails to produce anything:

db.mrtest.find( { "_id" : { "jobid" : "5051f299340b1", "type" : { $in: [2] }}} )

I get the impression that you can’t do such things with the _id field, or can you? I am thinking I need to re-organise my mr output instead but that feels like failing somehow ?!?!

Help!

PS: If anybody can explain why the count is contained in a field called “value”, that would also be welcome!”5051f299340b1″

  • 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-12T11:47:16+00:00Added an answer on June 12, 2026 at 11:47 am
    db.mrtest.find( { "_id.jobid": "506ea3a85e126" })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In CouchDB you always have to use map reduce to query results. In MongoDB
I have five map reduce that I am running each separately. I want to
I have a simple map/reduce job that scans one hbase table, and modifies another
I have simple map-reduce type algorithm, which I want to implement in python and
I want to execute a mapreduce query, in erlang, that contains two map phases
I have some different Map/Reduces functions that I use in my project. But one
I have a super simple map reduce test... that isn't working consistently. In a
I'm implementing a classical map-reduce program in which I have a parent that spwans
I have a map reduce job I am trying to run on a relatively
I have been trying to run a Avro map-reduce on oozie. I specify the

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.