DesignDocument accepts additional properties of type any.
Optional_attachmentsSchema for a map of attachment name to attachment metadata.
Optional_conflictsSchema for a list of document revision identifiers.
Optional_deletedDeletion flag. Available if document was removed.
Optional_deleted_Schema for a list of document revision identifiers.
Optional_idSchema for a design document ID including a _design/ prefix.
Optional_local_Document's update sequence in current database. Available if requested with local_seq=true query parameter.
Optional_revSchema for a document revision identifier.
Optional_revisionsSchema for list of revision information.
Optional_revs_Schema for a list of objects with information about local revisions and their status.
OptionalautoupdateIndicates whether to automatically build indexes defined in this design document.
OptionalfiltersSchema for filter functions definition. This schema is a map where keys are the names of the filter functions and values are the function definition in string format.
Filter function formats, or filters the changes feed that pass filter rules. The function takes 2 parameters:
doc: The document that is being processed.
req: A Request JavaScript object with these properties:
body - string, Request body data as string.
If the request method is GET this field contains the value
"undefined".
If the method is DELETE or HEAD the value is "" (empty string).cookie - Cookies object.form - Form Data object, contains the decoded body as key-value
pairs if the Content-Type header was
application/x-www-form-urlencoded.headers - Request Headers object.id - string, requested document id if it was specified
or null otherwise.info - Database Information object,
see DatabaseInformation.method - string or an array of chars, request method.
String value is a method as one of: HEAD, GET, POST, PUT,
DELETE, OPTIONS, TRACE, COPY. For not supported methods
it will be represented as an array of char codes e.g. for VIEW
it will be 86,73,69,87.path - array of strings, requested path sections.peer - string, request source IP address.query - string, URL query parameters object. Note that multiple
keys are not supported and the last key value suppresses others.requested_path - array of strings,
actual requested path section.raw_path - string, raw requested path.userCtx: User Context Object, containing information about the
user writing the document (if present), see the UserContext.secObj: Security Object, with lists of database security roles,
see the SecurityObject.uuid - string, generated UUID by a specified algorithm in the
config file.Filter functions must return true if a document passed all the rules.
OptionalindexesSearch (text) index function definitions.
OptionallanguageDefines Query Server key to process design document functions.
OptionaloptionsSchema for design document options.
OptionalvalidateValidate document update function can be used to prevent invalid or unauthorized document update requests from being stored. Validation functions typically examine the structure of the new document to ensure that required fields are present and to verify that the requesting user should be allowed to make changes to the document properties. When a write request is received for a given database, the validation function in each design document in that database is called in an unspecified order. If any of the validation functions throw an error, the write will not succeed.
The validation function can abort the pending document write by throwing one of two error objects:
// user is not authorized to make the change but may re-authenticate throw({ unauthorized: 'Error message here.'
});
// change is not allowed throw({ forbidden: 'Error message here.' });
The function takes 4 parameters:
newDoc - New version of document that will be stored
from the update request.oldDoc - Previous version of document that is already stored.userCtx - User Context Object, containing information about the
user writing the document (if present), see the UserContext.secObj - Security Object, with lists of database security roles,
see the SecurityObject.OptionalviewsSchema for design document views.
StaticdeserializeStaticserialize
Schema for a design document.
This type supports additional properties of type any.