curl - CouchDB View Multiple key-value pairs -


i'm new couchdb , want specify year-range set of documents. each document has year attribute. have defined view follows:

function(doc) {     emit(parseint(doc.year), doc.title); } 

i want select movies made between (for example) 2000 , 2005. far can understand, following curl command should work this.

curl http://127.0.0.1:5984/movies/_design/exercises/_view/ex11?startkey=2000&endkey=2005

however, when execute command, first key-value pair seems take effect (i.e. selects movies after 2000). if interchange order of startkey , endkey pairs case (i.e. selects movies before 2005)

furthermore, when execute curl command above, seems program not terminate in terminal. have manually terminate query using ctrl+c, doesn't happen other type of query.

each movie has following json structure (for reference):

{    "_id": "uf",    "_rev": "1-576d70babcd04fed2918f5c543bb7cf6",    "title": "unforgiven",    "year": "1992",    "genre": "western",    "summary": "the town of big whisky full of normal people trying lead quiet lives. cowboys try make living. sheriff 'little bill' tries build house , keep heavy-handed order. town whores try by.then couple of cowboys cut whore. unsatisfied bill's justice, prostitutes put bounty on cowboys. bounty attracts young gun billing himself 'the schofield kid', , aging killer william munny. munny reformed young wife, , has been raising crops , 2 children in peace. wife gone. farm life hard. , munny no @ it. calls old partner ned, saddles ornery nag, , rides off kill 1 more time, blurring lines between heroism , villainy, man , myth.",    "country": "usa",    "director": {        "last_name": "eastwood",        "first_name": "clint",        "birth_date": "1930"    },    "actors": [        {            "first_name": "clint",            "last_name": "eastwood",            "birth_date": "1930",            "role": "william munny"        },        {            "first_name": "gene",            "last_name": "hackman",            "birth_date": "1930",            "role": "little bill dagget"        },        {            "first_name": "morgan",            "last_name": "freeman",            "birth_date": "1937",            "role": "ned logan"        }    ] } 

your view fine.

the & in curl command being interpreted shell. put url in quotes:

curl "http://127.0.0.1:5984/movies/_design/exercises/_view/ex11?startkey=2000&endkey=2005" 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -