Remember that design document is still a document, which means that we can query it just as we would query a regular document. The only difference will be that we need to use a slightly different URL pattern to hit the correct file.
1. Open Terminal.
2. Use a
curl
statement to query our design document by passing a key ofjohndoe
(or another user in your database that has a decent amount of posts), then pass it throughpython mjson.tool
to make it a bit prettier:curl http://127.0.0.1:5984/verge/_design/application/_view/posts_by_user?key=%22johndoe%22 | python -mjson.tool
3. The terminal will respond with something similar to the following:
{ "offset": 0, "rows": [ { "id": "352e5c2d51fb1293c44a2146d4003aa3", "key": "johndoe", "value": { "_id": "352e5c2d51fb1293c44a2146d4003aa3", "_rev": "3-ced38337602bd6c0587dc2d9792f6cff", "content": "I don\\'t like peanut butter.", "date_created": "Wed, 28 Sep 2011 13:44:09 -0700", "type": "post", "user...