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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:51:12+00:00 2026-05-15T01:51:12+00:00

I am making reduce view for counting users notes for date range and I

  • 0

I am making reduce view for counting users notes for date range and I am in front of quite not-solving problem. Date range select is ok – I create array key [YYYY,MM,DD,user_id].

Document example:

{
   "_id": "1",
   "_rev": "1-84d3fa5f259c7b30c74028ca60a45f91",
   "body": "note text",
   "user_id": 666,
   "created_at": "Thu Apr 26 13:50:20 +0200 2010",
}

Map function:

function(doc){
   var created = new Date(doc.created_at);
   emit([created.getFullYear(),created.getMonth()+1,created.getDate(),doc.user_id],doc);
}

Reduce function:

_count

Until this OK – when I want to select all notes for selected date range, for example from 2010-02-02 to 2010-03-03:

reduce_view_name?startkey=[2010,02,01]&endkey=[2010,02,28,{}]&group_level=0

It is easy select sums notes/user/day – I change group_level to 4.
But what about I want count notes for selected date range with one notes sum per user? In this case I get 28 rows per user, but what about if you have 300 users? It will be 300×28=7400 rows (if everybody will be write everyday:).

2nd option is replace user_id from last place to the 1st, but in this case I need know id_user and make select for everyone separately.

Does anybody idea how to solve 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-15T01:51:12+00:00Added an answer on May 15, 2026 at 1:51 am

    Yes: add another view that has the key (from the map view) inverted, so that the username comes first and the date comes after that. I know it’s a little redundant, but it works like crazy. 😉

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

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Somewhat as an aside, you need to include "xs": SCHEMA_NAMESPACE… May 16, 2026 at 10:00 pm
  • Editorial Team
    Editorial Team added an answer Since the two correct answers didn't manage to convince you,… May 16, 2026 at 10:00 pm
  • Editorial Team
    Editorial Team added an answer A naive approach can be taking the sum of the… May 16, 2026 at 10:00 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a flash site that users can view full Screen video. the trouble
ASP.NET - I've managed to siginificantly reduce the number of .axd requests a page
Im making a small private message application in the form of a phone. Ten
I'm in the process of making some changes to a library that I'm using.
I am new to CouchDB way of making things. So, I have a lot
I'm working on making an ASCII based game, and everywhere I look people are
I have a custom view which is composed of a number of UIImageViews. These
I making some css buttons and I want to add an icon before the
i making a application where i need total amount of data used by user
im making an application that store multipe information like name description images for each

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.