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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:28:11+00:00 2026-05-31T00:28:11+00:00

I have a simple document named Order structure with the fields id, name, userId

  • 0

I have a simple document named Order structure with the fields id, name,
userId and timeScheduled.

What I would like to do is create a view where I can find the
document.id for those who’s userId is some value and timeScheduledis
after a given date.

My view:

"by_users_after_time": {
      "map": "function(doc) { if (doc.userId && doc.timeScheduled) {
emit([doc.timeScheduled, doc.userId], doc._id); }}"
  }

If I do

localhost:5984/orders/_design/Order/_view/by_users_after_time?startKey="[2012-01-01T11:40:52.280Z,f98ba9a518650a6c15c566fc6f00c157]"

I get every result back. Is there a way to access key[1] to do an if
doc.userId == key[1] or something along those lines and simply emit on the
time?

This would be the SQL equivalent of

select id from Order where userId =
"f98ba9a518650a6c15c566fc6f00c157" and timeScheduled >
2012-01-01T11:40:52.280Z;

I did quite a few Google searches but I can’t seem to find a good tutorial
on working with multiple keys. It’s also possible that my approach is
entirely flawed so any guidance would be appreciated.

  • 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-31T00:28:12+00:00Added an answer on May 31, 2026 at 12:28 am

    The answer actually came from the couchdb mailing list:

    Essentially, the Date.parse() doesn’t like the +0000 on the timestamps. By
    doing a substring and removing the +0000, everything worked.

    For the record,

    document.write(new Date("2012-02-13T16:18:19.565+0000")); //Outputs Invalid
    Date
    document.write(Date.parse("2012-02-13T16:18:19.565+0000")); //Outputs NaN
    

    But if you remove the +0000, both lines of code work perfectly.

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

Sidebar

Related Questions

I have a simple xml document that looks like the following snippet. I need
let's say I have a simple javascript like so: $(document).ready(function(){ if(login == 1) {
I have simple form set up like the following: <form> <input type=text name=first_number id=first_number
CouchDB, version 0.10.0, using native erlang views. I have a simple document of the
Situation: I have a simple XML document that contains image information. I need to
Suppose I have a simple XHTML document that uses a custom namespace for attributes:
I have a URI here in which a simple document.cookie query through the console
very simple question (but I can't find the answer on the Web...): I have
Hi there I have a procedure like so: CREATE PROCEDURE dbo.DWS_PROG ( @fromDate datetime
I'm using Rails3 and have created a simple document table with a document_name (string)

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.