couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Iriele <siri...@breaktimestudios.com>
Subject Re: CouchDB: Adding Map and Reduce Functions from command line using curl
Date Mon, 29 Jul 2013 00:46:15 GMT
Install Erica and it will make your life a lot better as far as pishing and
pulling design docs go
On Jul 28, 2013 7:16 PM, "Hank Knight" <hknight555@gmail.com> wrote:

> I use the following from a Linux command line to create a database and
> add documents:
> curl -X PUT http://zurv3aqzm.iriscouch.com/xfruits
> curl -X POST http://zurv3aqzm.iriscouch.com/xfruits -d
> '{"_id":"1","user":"joe","xfruits":"peach","type":"pits"}' -H
> "Content-Type: application/json"
> curl -X POST http://zurv3aqzm.iriscouch.com/xfruits -d
> '{"_id":"2","user":"joe","xfruits":"blueberry","type":"berries"}' -H
> "Content-Type: application/json"
> curl -X POST http://zurv3aqzm.iriscouch.com/xfruits -d
> '{"_id":"3","user":"joe","xfruits":"strawberry","type":"berries"}' -H
> "Content-Type: application/json"
> curl -X POST http://zurv3aqzm.iriscouch.com/xfruits -d
> '{"_id":"4","user":"joe","xfruits":"strawberry","type":"berries"}' -H
> "Content-Type: application/json"
>
> Here is my map function:
> function(doc) {
>   if (doc.fruits) emit(doc.fruits,doc.type.length);
> }
>
> Here is my reduce function:
> _count
>
> I know how to add the map function and reduce function using the admin
> panel but how can I add these using only a command line with curl?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message