< Back

Find-CouchDBDocuments

Sun Jan 19, 2020 6:29 pm

NAME Find-CouchDBDocuments



SYNOPSIS

Find document data in a database.





SYNTAX

Find-CouchDBDocuments [-Server <String>] [-Port <Int32>] [-Database <String>] [-Explain] [-Selector <String>]

[-Value <Object>] [-Limit <Int32>] [-Skip <Int32>] [-Fields <Array>] [-Sort <Array>] [-UseIndex <Array>]

[-ReadQuorum <Int32>] [-Bookmark <String>] [-NoUpdate] [-Stable] [-Stale <String>] [-ExecutionStats] [-Operator

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



Find-CouchDBDocuments [-Server <String>] [-Port <Int32>] [-Database <String>] [-Find <String>] [-Authorization

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





DESCRIPTION

Find documents using a declarative JSON querying syntax. Queries can use the built-in _all_docs index or custom

indexes, specified using the _index endpoint.





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? true (ByValue)

Accept wildcard characters? false



-Explain [<SwitchParameter>]

The CouchDB database _explain.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Selector <String>

The selector of Mango query.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Value <Object>

The value of selector of Mango query.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Limit <Int32>

The limit number of documents that come back.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Skip <Int32>

The skip number of documents that come back.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Fields <Array>

Array of fields that can return.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Sort <Array>

Array of sort fields that can return.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UseIndex <Array>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ReadQuorum <Int32>

The ReadQuorum number.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Bookmark <String>

The Bookmark that can use.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoUpdate [<SwitchParameter>]

Disable document update.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Stable [<SwitchParameter>]

Whether or not the view results should be returned from a ????????????????stable??????????????? set of shards.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Stale <String>

Combination of update=false and stable=true options. Possible options: "ok".



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ExecutionStats [<SwitchParameter>]

Include execution statistics in the query response.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Operator <String>

The comparison operator.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Find <String>

The Json query structure.



Required? false

Position? named

Default value

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:

POST /{db}/_find

POST /{db}/_explain



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



PS C:\\>Find-CouchDBDocuments -Database test -Selector "name" -Operator eq -Value "Arthur Dent" -Fields

_id,name,planet



The example query a database "test" with manual selector and operator.









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



PS C:\\>Find-CouchDBDocuments -Database test -Find '{"selector": {"name":{"$eq":"Arthur

Dent"}},"fields":["_id","name","planet"]}'



The example query a database "test" with native Mango query.









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



PS C:\\>using module PSCouchDB



$q = New-Object -TypeName PSCouchDBQuery

$q.AddSelector("name","Arthur Dent")

$q.AddSelectorOperator('$eq')

$q.AddFields("_id")

$q.AddFields("name")

$q.AddFields("planet")

Find-CouchDBDocuments -Database test -Find $q.GetNativeQuery()

The example query a database "test" with PSCouchDBQuery object.











RELATED LINKS

https://pscouchdb.readthedocs.io/en/lat ... html#query

https://pscouchdb.readthedocs.io/en/lat ... uery-class