Skip to content

Commit

Permalink
Complete Readme with other examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Guadrini committed Feb 20, 2018
1 parent eeaaa5a commit 7a273e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
10 changes: 5 additions & 5 deletions PSCouchDB/PSCouchDB.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ function Revoke-CouchDBDatabasePermission () {
$Database = $(throw "Please specify the database name."),
$Authorization
)
if ($PSCmdlet.ShouldContinue("Do you wish revoke all permission on database $Database?","Revoke all permission on database $Databasee")) {
if ($PSCmdlet.ShouldContinue("Do you wish revoke all permission on database $Database ?","Revoke all permission on database $Database")) {
# Get a current security permission
if (-not(Get-CouchDBDocument -Database $Database -Document '_security' -Authorization $Authorization)) {
throw "No security object found in database $Database"
Expand Down Expand Up @@ -496,7 +496,7 @@ function Remove-CouchDBDatabase () {
$Database = $(throw "Please specify the database name."),
$Authorization
)
if ($PSCmdlet.ShouldContinue("Do you wish remove database $Database?","Remove database $Databasee")) {
if ($PSCmdlet.ShouldContinue("Do you wish remove database $Database ?","Remove database $Database")) {
Send-CouchDBRequest -Server $Server -Port $Port -Method "DELETE" -Database $Database -Authorization $Authorization
}
}
Expand All @@ -519,7 +519,7 @@ function Remove-CouchDBDocument () {
$Revision = $(throw "Please specify the revision id."),
$Authorization
)
if ($PSCmdlet.ShouldContinue("Do you wish remove document $Document on database $Database?","Remove document $Document on database $Databasee")) {
if ($PSCmdlet.ShouldContinue("Do you wish remove document $Document on database $Database ?","Remove document $Document on database $Database")) {
Send-CouchDBRequest -Server $Server -Port $Port -Method "DELETE" -Database $Database -Document $Document -Revision $Revision -Authorization $Authorization
}
}
Expand All @@ -543,7 +543,7 @@ function Remove-CouchDBAttachment () {
$Revision = $(throw "Please specify the revision id."),
$Authorization
)
if ($PSCmdlet.ShouldContinue("Do you wish remove attachment $Attachment in document $Document on database $Database?","Remove attachment $Attachment in document $Document on database $Databasee")) {
if ($PSCmdlet.ShouldContinue("Do you wish remove attachment $Attachment in document $Document on database $Database ?","Remove attachment $Attachment in document $Document on database $Database")) {
Send-CouchDBRequest -Server $Server -Port $Port -Method "DELETE" -Database $Database -Document $Document -Attachment $Attachment -Revision $Revision -Authorization $Authorization
}
}
Expand All @@ -567,7 +567,7 @@ function Remove-CouchDBUser () {
$Authorization
)
$Document = "org.couchdb.user:$Userid"
if ($PSCmdlet.ShouldContinue("Do you wish remove user $Userid?","Remove $Userid on database $Database")) {
if ($PSCmdlet.ShouldContinue("Do you wish remove user $Userid ?","Remove $Userid on database $Database")) {
Send-CouchDBRequest -Server $Server -Port $Port -Method "DELETE" -Database $Database -Document $Document -Revision $Revision -Authorization $Authorization
}
}
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To search for data in a specific database, use this cmdlet:
```powershell
Find-CouchDBDocuments -Database test -Selector "color" -Value "red" -Fields _id,color -Operator eq
```
`Selector` is the search field; `Value` is the value of the selector; `Fields` they are the fields that come back from the research and `Operator` it is the logical operator used to compare the selector.
`Selector` is the search field; `Value` is the value of the selector; `Fields` they are the fields that return from the research and `Operator` it is the comparison operator used to compare the selector.
The operators available, for now, are the following:
- 'lt' The field is less than the argument.
- 'lte' The field is less than or equal to the argument.
Expand All @@ -79,6 +79,20 @@ The operators available, for now, are the following:
- 'regex' A regular expression pattern to match against the document field. Only matches when the field is a string value and matches the supplied regular expression. The matching algorithms are based on the Perl Compatible Regular Expression (PCRE) library. For more information about what is implemented, see the see the [Erlang Regular Expression](http://erlang.org/doc/man/re.html "Perl-like regular expressions for Erlang")
`Sort` indicates the field you want to sort ascending data.

### Find data with other operator
Search data with other comparison operator:
```powershell
Find-CouchDBDocuments -Database test -Selector "answer" -Value 42 -Fields _id,answer -Operator lt
Find-CouchDBDocuments -Database test -Selector "answer" -Value 42 -Fields _id,answer -Operator gt
Find-CouchDBDocuments -Database test -Selector "color" -Value "blue" -Fields _id,color -Operator ne
Find-CouchDBDocuments -Database test -Selector "color" -Value true -Fields _id,color -Operator exists
Find-CouchDBDocuments -Database test -Selector "color" -Value string -Fields _id,color -Operator type
Find-CouchDBDocuments -Database test -Selector "answer" -Value number -Fields _id,answer -Operator type
Find-CouchDBDocuments -Database test -Selector "array" -Value "value1" -Fields _id,array -Operator in
Find-CouchDBDocuments -Database test -Selector "array" -Value "value 2" -Fields _id,array -Operator nin
Find-CouchDBDocuments -Database test -Selector "array" -Value 1 -Fields _id,array -Operator size
Find-CouchDBDocuments -Database test -Selector "color" -Value "^[rR].[dD]" -Fields _id,color -Operator regex
```

### Cmdlet example
To get examples of all the cmdlets of this module, use this command:
Expand Down

0 comments on commit 7a273e5

Please sign in to comment.