cdb-cli v1.1.2
cdb-cli
Command line tool for interacting with CouchDB
Table of contents
Getting started
Installation
npm i -g cdb-cliConfiguration
Upon installation a default URL, default credentials, and default database will be set for you.
The URL is set to http://localhost:5984,the credentials are set to admin:pass, and the database is set to an empty string (meaning that no default database is set).
You can edit them with the following commands:
cdb set --url http://mycustomurl.com/
cdb set --auth username:password
cdb set --database example
# setting multiple defaults at the same time
cdb set --url http://mycustomurl.com --auth username:passwordSetting a default database will allow you to omit the database argument in all of the document functions, although you can still provide it if you want.
Database functions
Create database
database - the name of the database
cdb create databaseDelete database
database - the name of the database
cdb destroy databaseGet database info
database - the name of the database
cdb info databaseGet all databases
cdb allReplicate database
source - the name of the database to be replicated
target - the name of the database to replicate to
If the target database does not exist then it will be created before replicating.
cdb replicate source targetDocument functions
Insert document
database - the name of the database
document - the document as a JSON string or the relative path to the JSON document
cdb insert database documentDelete document
database - the name of the database
document - the ID of the document
cdb delete database documentRead document
database - the name of the database
document - the ID of the document
cdb read database documentUpdate document
database - the name of the database
document - the updated document
cdb update database documentMiscellaneous functions
Help
# any of these will work
cdb help
cdb --help
cdb -hVersion
# any of these will work
cdb version
cdb --version
cdb -v