< Back

Set-CouchDBDesignDocument

Sun Jan 19, 2020 6:34 pm

NAME Set-CouchDBDesignDocument



SYNOPSIS

Modify a design document.





SYNTAX

Set-CouchDBDesignDocument [-Server <String>] [-Port <Int32>] [-Database <String>] [-Document <String>] [-ViewName

<String>] [-ViewKey <String>] [-ViewValue <String>] [-GetDoc] [-Replace] [-Authorization <String>] [-Ssl]

[<CommonParameters>]



Set-CouchDBDesignDocument [-Server <String>] [-Port <Int32>] [-Database <String>] [-Document <String>] [-Data

<Object>] [-Replace] [-Authorization <String>] [-Ssl] [<CommonParameters>]



Set-CouchDBDesignDocument [-Server <String>] [-Port <Int32>] [-Database <String>] [-Document <String>]

[-ValidationRequirements <Array>] [-ValidationAuthor] [-Replace] [-Authorization <String>] [-Ssl]

[<CommonParameters>]



Set-CouchDBDesignDocument [-Server <String>] [-Port <Int32>] [-Database <String>] [-Document <String>] [-ShowName

<String>] [-ShowKey <String>] [-ShowValue <String>] [-Replace] [-Authorization <String>] [-Ssl]

[<CommonParameters>]



Set-CouchDBDesignDocument [-Server <String>] [-Port <Int32>] [-Database <String>] [-Document <String>] [-ViewName

<String>] [-ViewKey <String>] [-ViewValue <String>] [-GetDoc] [-ListName <String>] [-Replace] [-Authorization

<String>] [-Ssl] [<CommonParameters>]





DESCRIPTION

Creates a new revision of the existing design document.





PARAMETERS

-Server <String>

The CouchDB server name. Default is localhost.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Port <Int32>

The CouchDB server port. Default is 5984.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Database <String>

The CouchDB database.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Document <String>

The CouchDB document.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-ViewName <String>

The name of function view in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ViewKey <String>

The key of function view in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ViewValue <String>

The value of key of function view in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-GetDoc [<SwitchParameter>]

Return all element of doc of function view in the design document.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ListName <String>

The name of function list in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ShowName <String>

The name of function show in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ShowKey <String>

The key of function show in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ShowValue <String>

The value of key of function show in the design document.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ValidationRequirements <Array>

Array of key than required validation.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ValidationAuthor [<SwitchParameter>]

Enable validation author.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Data <Object>

The data in Json format or hastable.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Replace [<SwitchParameter>]

Overwrite design document.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Authorization <String>

The CouchDB authorization form; user and password.

Authorization format like this: user:password

ATTENTION: if the password is not specified, it will be prompted.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Ssl [<SwitchParameter>]

Set ssl connection on CouchDB server.

This modify protocol to https and port to 6984.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





CouchDB API:

PUT /{db}/_design/{ddoc}



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-CouchDBDesignDocument -Database test -Document "space" -ViewName "planet_view" -Authorization

"admin:password"



The example modify "space" design document with add or modify "planet_view" view.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$data = '{"views":{"data_test":{"map":"function(doc) {emit(doc._id, doc._rev)}"}}}'



Set-CouchDBDesignDocument -Database test -Document "space" -Data $data -Authorization "admin:password"

The example modify "space" design document with custom data.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Set-CouchDBDesignDocument -Database test -Document space -ShowName planet -ShowKey planet -ShowValue

"Heart" -Authorization "admin:password"



The example modify "space" design document with add or modify "planet" show, where "planet" key equal "Heart".











RELATED LINKS

https://pscouchdb.readthedocs.io/en/latest/ddoc.html