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

  • Home
  • SEARCH
  • 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 675195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:47:29+00:00 2026-05-14T00:47:29+00:00

I am trying to setup the following view on CouchDB { _id:_design/id, _rev:1-9be2e55e05ac368da3047841f301203d, language:javascript,

  • 0

I am trying to setup the following view on CouchDB

{
"_id":"_design/id",
"_rev":"1-9be2e55e05ac368da3047841f301203d",
"language":"javascript",
    "views":{ "by_id":{
              "map" : "function(doc) { emit(doc.id, doc)}"
        },"from_user_id":{
            "map" : "function(doc) { if (doc.from_user_id) {emit(doc.from_user_id, doc)}}"},
        "from_user":{
            "map" : "function(doc) { if (doc.from_user) {emit(doc.from_user, doc)}}"},
        "to_user_id":{
            "map" : "function(doc) {if (doc.to_user_id){ emit(doc.to_user_id, doc)}}"},
        "to_user":{
            "map" : "function(doc) {if (doc.to_user){ emit(doc.to_user, doc)}}" },
        "max_id":{
         "map" : "function(doc) { if (doc.id) {emit(doc._id, eval(doc.id))}}",  
         "reduce" :"function(key,value) { a = value[0]; for (i=1; i <value.length; ++i){a =    Math.max(a,value[i])} return a}"
        }
    }
}

when I try to ‘PUT’ this using curl:

 curl -X PUT -d keys.json  $CDB/_design/id
 {"error":"bad_request","reason":"invalid UTF-8 JSON"}

I know it’s not invalid JSON, because I tested it using the ‘json’ library built into Python 2.6, it loads fine. JS screw ups give me the error ‘must evaluate to a function’

I have checked the file with od, there are no hidden control chars, my system is set to UTF-8. I’m using CouchDB version 0.10.1

What else might be wrong with 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-14T00:47:29+00:00Added an answer on May 14, 2026 at 12:47 am

    @titanoba hinted at the problem:

    The -d option of curl expects the actual data as the argument!

    If you want to provide the data in a file, you need to prefix it with @:

    curl -X PUT -d @keys.json  $CDB/_design/id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to setup my asp.net mvc page like the following image: The header
I am trying to setup my swap chain Buffer but I get the following
I'm trying to setup a mod_rewrite that will allow for the following redirections: my-domain/login
I'm getting the following error when trying to setup SQL Server 2005 DB Mirroring
I'm trying to setup CORS support in grails, and I'm using the following filter:
In C#.net, I have the following DataSource setup that I am trying to dynamically
I'm trying to setup Ember.js with Rails 3.1 and I'm getting the following error
I am trying to get nested viewflippers set up with the following setup Top_ViewFlipper
I'm just learning Django and trying to setup the View and URLconfs ( http://djangobook.com/en/2.0/chapter03/
I'm trying to setup my charset in a html view in a RoR application.

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.