1

I have a key in key field in couchdb. where my key differs for each document. I need to get documents for various keys: say 1st key is "123123", 2nd key is "234234", I have to pass these in a single query and get results for both the keys using curl command.

In SQL we can do it as:

select * from table where user_id in "123123,234234"; 

Similarly I need to do this in couchdb using curl. Is this possible using curl command?

Thanks in advance.

1
  • Is this a homework question? Commented Dec 17, 2012 at 17:10

1 Answer 1

1

Sure it is:

curl -X POST http://localhost:5984/mydb/_design/users/_view/by_user_id -d '{"keys": ["123123", "234234"]}' -H "Content-Type: application/json"

More about CouchDB views query options

Sign up to request clarification or add additional context in comments.

2 Comments

Kxepal : thanks for the help... but this doesn't work for me... its fetching all the results from that view....
@Ramesh , hm, probably you're right: tested it only for 1.3, which has better content type negotiation. Updated command by adding explicit content type header.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.