-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Description
http://guide.couchdb.org/draft/views.html#one
Say we know the date of a blog post. To find a single document, we would use /blog/_design/docs/_view/by_date?key="2009/01/30 18:04:11" to get the “Biking” blog post. Remember that you can place whatever you like in the key parameter to the emit() function.
Again, just following along. I can't make it work to get just one document. Here's my successful request to get all docs:
$ curl http://127.0.0.1:5984/basic/_design/blog/_view/by_date
{"total_rows":3,"offset":0,"rows":[
{"id":"hello-world","key":"2009/01/15 15:52:20","value":"Hello World"},
{"id":"biking","key":"2009/01/30 18:04:11","value":"Biking"},
{"id":"bought-a-cat","key":"2009/02/17 21:13:39","value":"Bought a Cat"}
]}
And here's me failing to grab a single doc by key:
$ curl http://127.0.0.1:5984/basic/_design/blog/_view/by_date?key="2009/01/15 15:52:20"
$ curl http://127.0.0.1:5984/basic/_design/blog/_view/by_date?key="2009%2F01%2F15 15:52:20"
{"error":"bad_request","reason":"invalid_json"}
$ curl http://127.0.0.1:5984/basic/_design/blog/_view/by_date?key="2009%2F01%2F15%2015%3A52%3A20"
{"error":"bad_request","reason":"invalid_json"}
$ curl -v http://127.0.0.1:5984/basic/_design/blog/_view/by_date?key="2009/01/15 15:52:20"
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
> GET /basic/_design/blog/_view/bydate?key=2009/01/15 15:52:20 HTTP/1.1
> Host: 127.0.0.1:5984
> User-Agent: curl/7.42.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Server: MochiWeb/1.0 (Any of you quaids got a smint?)
< Date: Sun, 27 Mar 2016 20:07:25 GMT
< Content-Length: 0
<
* Connection #0 to host 127.0.0.1 left intact
Not sure if this is an issue with the documentation, or if I'm just being an idiot...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels