Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

unable to get basic view working in web console

1 reply [Last post]
  • Login or register to post comments
Thu, 11/01/2012 - 13:03
sskarupa
Offline
Joined: 07/27/2012
Groups: None

I'm a newbie and I'm trying to figure out how to setup a view for my documents... The whole concept of a map() is pretty strange to me, so I decided to experiment with your beer-sample bucket. I decided to start simple: I just want to create a view that essentially lets me find a beer by name. However, I don't seem to be getting anywhere.

My first attempt at the view looks like this:
function (doc, meta)
{
if(doc.name)
{
emit(doc.name, null);
}
}

I hit "Save" button and then modified the "key" field in the "Filter Results" drop down to = "New Albanian Brewing". I then hit "Show results". I get back:

{"error":"bad_request","reason":"invalid UTF-8 JSON: {{error,{1,\"lexical error: invalid char in json text.\\n\"}},\n \"New Albanian Brewing\"}"}

I poked around the site and saw some posts about \r and windows boxes, and since I'm running on Windows 7(64x), I decided to take all of the carriage returns out of the function:

function (doc, meta) { if(doc.name) { emit(doc.name, null); } }

"Save" button and then "Show results". Same answer:

{"error":"bad_request","reason":"invalid UTF-8 JSON: {{error,{1,\"lexical error: invalid char in json text.\\n\"}},\n \"New Albanian Brewing\"}"}

What am I doing wrong?

NOTES:
> I'm running Version: 2.0.0 community edition (build-1723)
> using Firefox 14.0.1
> I've been a homebrewer for 10+ years and love the fact that this product uses Beer/brewing for it's samples and documentation.... awesome.

Thanks in advance,
-Steve

Top
  • Login or register to post comments
Thu, 11/01/2012 - 13:53
sskarupa
Offline
Joined: 07/27/2012
Groups: None

ok. found the issue... When you fill in the text box in the Filter Results drop down next to the keys field you MUST put in quotes around the value you are searching.

http:// localhost:8092/beer-sample/_design/dev_beertest/_view/name?key=%22Pyramid+Thunderhead+IPA%22&connection_timeout=60000&limit=10&skip=0

Not:
http:// localhost:8092/beer-sample/_design/dev_beertest/_view/name?key=Pyramid+Thunderhead+IPA&connection_timeout=60000&limit=10&skip=0

Now I can experiment away!

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker