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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:41:03+00:00 2026-06-02T14:41:03+00:00

trying to group by date and number my document { _id : ObjectId(4f956dee76ddb26752026e8f), request

  • 0

trying to group by date and number

my document

 { "_id" : ObjectId("4f956dee76ddb26752026e8f"), "request" : "default", "options" : "1", "keyword" : "somekey", "number" : "5b234b79-4d70-437e-8eef-32a2941af40a", "date" : "20120423200446", "time" : 1335193066 }

my query

map = "function() { var date = new Date(this.time * 1000); var key = date.getFullYear() + date.getMonth() + date.getDate(); emit({day : key, number: this.number}, {count: 1}); }"

reduce = "function(key, values) { var count = 0; values.forEach(function(v) { count += v['count']; }); return {count: count}; }"

db.txtweb.mapReduce(map, reduce, {out: "pageview_results"});

my error

uncaught exception: map reduce failed:{ "errmsg" : "ns doesn't exist", "ok" : 0 }

I cannot figure out whats wrong, but I think it is do something with the date functionality.

Any ideas.

  • 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-02T14:41:05+00:00Added an answer on June 2, 2026 at 2:41 pm

    ns doesn't exist means that you’re accessing a non-existent database or collection. Check their names

    Script below group this.amount by day (without time)

         db.payments.mapReduce(
                 function() {
                     var k = new Date(this.payment_time);
                     k.setMinutes(0);
                     k.setSeconds(0);
                     k.setMilliseconds(0);
                     emit(k, this.amount);
                 }, 
                 function (key, vals) {
                     var total = 0;
                     for (var i = 0; i < vals.length; i++) {
                         total += vals[i];
                     }
                     return total;
                 },
                 {
                  out : {merge : "resultName" }
                 }
         );
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to match & group ( any phrase )##date##( any phrase ),
I am trying to group a number of customers together based on their Head
I am trying to count the number of new records for a given date
I am trying to group radiobuttons together with groupname property.. It doesnt work because
I am trying to group results from an observations table. My table contains stock
I'm trying to group a set of data based on the range of an
I am trying to group a data collection and send it to the View
I'm trying to group down records by their priority levels, e.g. --- Priority: High
I'm trying to group the following string into three groups. 0:0:Awesome:awesome That being "
I'm trying to group posts from same day, the problem is that 2/20 gets

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.