PSCouchDB Save

Advanced CLI for CouchDB server

Project README

PSCouchDB: Advanced CLI for CouchDB server

PSCouchDB

Docs: ReadTheDocs

Installation and simple usage

  1. Download and install CouchDB following the docs.
  2. Download and install latest PSCouchDB module by copying it under %Windir%\System32\WindowsPowerShell\v1.0\Modules for all users or under %UserProfile%\Documents\WindowsPowerShell\Modules for the current user or install through PowershellGallery.

INFORMATION: This module is not signed. Before import or execute cmdlet on this module, see about_signing session. To skip this part and continue, run Set-ExecutionPolicy -ExecutionPolicy Unrestricted ATTENTION: If you are using CouchDB version 2, use the PSCouchDB 1.X version; if instead you are using CouchDB version 3 or 4, use the PSCouchDB version 2.X```

  1. Now, configure database mode, in single node (cluster of one single node) or cluster, run this cmdlet:
# Single node cluster
Enable-CouchDBCluster -SingleNode -Authorization "admin:password"
# Cluster (with three node)
Enable-CouchDBCluster -Authorization "admin:password"

For more details, see the docs.

  1. Now, open powershell and create a first personal database:
New-CouchDBDatabase -Database test -Authorization "admin:password"
  1. Create a sample document for test database:
$Data = '{
	"name": "Arthur Dent",
	"planet": "Heart"
}'
New-CouchDBDocument -Database test -Document "Hitchhikers" -Data $Data -Authorization "admin:password"
  1. Add attachment file in our docuemnt:
$rev = (Get-CouchDBDocument -Database test -Document "Hitchhikers")._rev
"Ultimate Question of Life, the Universe and Everything" | Out-File C:\file.txt
New-CouchDBAttachment -Database test -Document "Hitchhikers" -revision $rev -Attachment C:\file.txt -Authorization "admin:password"
  1. Finally, get a document:
Get-CouchDBAttachment -Database test -Document "Hitchhikers" -Attachment file.txt

These are just some of the operations you can do with this CLI. PSCouchDB supports all API of CouchDB server. If you want to find out more, follow the docs.

Test PSCouchDB

Before test this module, install latest version of CouchDB server and latest installation of Pester module.

WARNING: Test this module in testing enviroment ONLY.

git clone "https://github.com/MatteoGuadrini/PSCouchDB.git"
cd "PSCouchDB/PSCouchDB/tests"
foreach ($f in (Get-ChildItem $PWD)) {
	& pwsh $f.FullName		# use powershell before 6.X
}

Complete documentation

For other operation, for more details and for learning all cmdlets and possibilities, see the docs.

Kanban board

If you are curious, if you want to contribute or simply see the features, look at the project's kanban board here: KANBAN.

Cmdlet help

If you want to have an overview of the module, do this:

help about_pscouchdb

Search for the cmdlets using a keyword pattern and then view the help:

Search-CouchDBHelp -Pattern Database | foreach {Get-Help $_.Name}

or see docs. For a little demonstration, see here

Licence

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Treeware

Donation and Support.

Open Source Agenda is not affiliated with "PSCouchDB" Project. README Source: MatteoGuadrini/PSCouchDB