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

Simple HTTP View Query using CURL

1 reply [Last post]
  • Login or register to post comments
Sun, 03/04/2012 - 07:51
GQAdonis
Offline
Joined: 02/25/2012
Groups: None

Okay, I feel pretty stupid having built the Couchbase 2.0 preview from source and not even being able to query a simple view using CURL, but I am at the end of my rope and going to ask the stupid question anyway:

How do I simply use CURL in a CouchDB-specific manner (not memcached and using HTTP) to return the JSON associated with a view I created using a test document?

I am new to CouchDB and Couchbase, watched a bunch of videos, and apparently am still not getting how to do this simple thing. My apologies for the stupid question.

For your reference, I have created a single document and a development view called "notes".

Thanks,
Travis

Top
  • Login or register to post comments
Mon, 03/05/2012 - 08:12
dipti
Offline
Joined: 11/02/2011
Groups:

Hi Travis,

To query the view, try curl -X GET http://127.0.0.1:8092/default/_design/<design_doc_name>/_view/<view_name>
Note: replace <design_doc_name> and <view_name>.

Here's an example of query results from a view name "test" that I created where I only want the JSON documents that match the key "Dipti"

dipti$ curl -X GET http://127.0.0.1:8092/default/_design/dev_test/_view/test?key=\"Dipti\"

{"total_rows":10,"rows":[
{"id":"dipti1","key":"Dipti","value":{"id":27,"type":"newMessage","msg":"notification"}},
{"id":"dipti2","key":"Dipti","value":{"id":28,"type":"newMessage","msg":"notification"}},
{"id":"dipti3","key":"Dipti","value":{"id":30,"type":"newMessage","msg":"notification"}},
{"id":"dipti4","key":"Dipti","value":{"id":30,"type":"newMessage","msg":"notification"}},
{"id":"dipti5","key":"Dipti","value":{"id":31,"type":"newMessage","msg":"notification"}},
{"id":"dipti6","key":"Dipti","value":{"id":32,"type":"newMessage","msg":"notification"}},
{"id":"dipti8","key":"Dipti","value":{"id":33,"type":"newMessage","msg":"notification"}},
{"id":"dipti9","key":"Dipti","value":{"id":34,"type":"newMessage","msg":"notification"}}
]
}

You can find more information on the different arguments you can use for querying here: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...

hope this helps.

- Dipti

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