Skip to content

Re_ Comment on "Show Functions" #231

Open
@janl

Description

@janl

I guess it worked for early revisions, but now it's outdated.

Surpirisingly enough, the real structure of request object
is explained in the next chapter, lists:

"""
The request itself is a much richer data structure. This is the same
request object that is available to shows, update and filter
functions. We=E2=80=99ll go through it in detail here as a reference. Here=
=E2=80=99s
the example req object:

{
"info": {
"db_name": "test_suite_db","doc_count": 11,"doc_del_count": 0,
"update_seq": 11,"purge_seq": 0,"compact_running":
false,"disk_size": 4930,
"instance_start_time": "1250046852578425","disk_format_version":
4},

"verb": "GET",
"path":
["test_suite_db","_design","lists","_list","basicJSON","basicView"],
"query": {"foo":"bar"},

The database info, as available in an info request against a db=E2=80=99s U=
RL,
is included in the request parameters. This allows you to stamp
rendered rows with an update sequence, and know the database you are
working with.
The HTTP verb and the path in the client from the client request are
useful, especially for rendering links to other resources within the
application.
If there are parameters in the query string (in this case
corresponding to ?foo=3Dbar) they will be parsed and available as a JSON
object at req.query.

blah-blah...
"""

So in order to made it work, s/req.parrot/req.query.parrot/
and you're done!

PS. By the way, it's not the only case when in this book
something is used (and sometimes in wrong way), but
fortunately, it's explained the right way, later.

On 21 =D0=BD=D0=BE=D1=8F, 21:43, thomasvs svsam...@gmail.com wrote:

Fromhttp://books.couchdb.org/relax/design-documents/shows

Aye aye, " =C2=A0 req.parrot =C2=A0 "!

Does this example even work ? First of all, it has doc and req
switched around as arguments. =C2=A0Second, when fixing that, req.parrot =
is
undefined no matter how I call it.
token=40859aae6b9645cadaaa9f68d22b1800login=janl

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions