简体   繁体   中英

couch db - URI address

I have bd "List" with some products like:

{
   "_id": "car1",
   "_rev": "1-6e192e3f87447ec187052941cf365071",
   "price": "950",
   "shop": "Shop1"
}

I have created view "Shop" to check what products/cars i have at one of 3 shops:

  function(doc) {
  emit(doc.shop,{product:doc._id});
}

Reduce function

function (key, values) {return (values);}

Now I would like to receive same but with URI so i did something like this:

...\curl -X GET .../List/_design/Shop/_view/Shop?key="Shop1"

why it doesn't work? questions like: ...\\curl -X GET .../List/_all_docs works well views also so why i can't get result from the view?

If your function above is exactly what you have written, it's invalid javascript so your view will immediately crash and return nothing. You need quotes around product .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM