Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-442

Add a "view" or "format" function to process source doc on query

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Later
    • None
    • None
    • JavaScript View Server
    • None

    Description

      It is common practice to do emit(key, null) in a map function and then query with ?include_docs=true to retrieve the documents that were responsible for the entries. However, the full document may include information that is privileged or the full document may be substantially larger than the information needed to be transferred to the client.

      The proposed enhancement is to allow defining a "view" function in addition to the existing "map" and "reduce" on a view. If specified, the view function would take the id, key, value and doc and return a JSON value that would be added as the "view" member to the row in the result set.

      One of the use cases on http://wiki.apache.org/couchdb/Authentication_and_Authorization is to be able to specify that a user can retrieve the values from a view, but not add include_docs since that may expose information that they are not authorized to view. Without the "view" function, there would be pressure to start pushing things into the emitted value.

      Production of views would be likely controlled using a include_views=true in the query string.

      Attachments

        Activity

          People

            Unassigned Unassigned
            carnold@apache.org Curt Arnold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: