CouchDB API¶
The CouchDB API provides a set of endpoints for managing databases, documents, and performing CRUD operations. It allows users to interact with CouchDB clusters programmatically.
Why Integrate CouchDB with EasyTask?¶
Integrating CouchDB with EasyTask enables you to automate NoSQL document database operations with ease. This integration allows you to:
- Automate Document Management: Create databases, insert documents in bulk, update records, and query data programmatically as part of your EasyTask workflows.
- Flexible Query and Search: Use Mango queries with selectors to find, filter, and transform documents automatically, enabling sophisticated data processing pipelines.
- Scalable Data Operations: Perform bulk inserts, batch updates, and mass deletions efficiently through EasyTask orchestration, handling large datasets without manual effort.
Required Values in Vault¶
{
"secret": {
"couch_host": "xx.x.xx.xxx",
"couch_password": "*******",
"couch_port": "xxxx",
"couch_user": "xxxxx"
}
}
Example Usage¶
curl -X POST http://localhost:8008/run-integration \
-H "Content-Type: application/json" \
-d '{
"is_credentials": {
"userid": "test",
"passwd": "test123"
},
"integration": "couchdb",
"uuid": "ae0e8ba9-423a-410e-bba5-e1933ff868c5",
"init": {
"vault_path_key": "couchdb/secret"
},
"action": [
{
"create_database": {
"database": "couch2"
}
}
]
}'
Functions¶
create_database¶
create_database: This function creates a new database in CouchDB.
create_collection¶
create_collection: This function creates a new document in the specified database.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| db_name | str | Name of the database | yes |
| doc_id | str | ID of the document to be created | yes |
| doc | dict | Document content | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | dict | Contains the ID and revision of the created document |
update_one¶
update_one: This function updates a single document in the specified database.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| db_name | str | Name of the database | yes |
| doc_id | str | ID of the document to be updated | yes |
| data | dict | New data to update the document | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | dict | Contains the ID and new revision of the updated document |
update_many¶
update_many: This function updates multiple documents in the specified database based on a query.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| db_name | str | Name of the database | yes |
| query | dict | Query to select documents for update | yes |
| docs | dict | New data to update the selected documents | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | dict | Contains the number of documents updated |
find¶
find: This function finds documents in the specified database based on a selector.
find_all¶
find_all: This function retrieves all documents from the specified database.
select_distinct¶
select_distinct: This function retrieves distinct values for a specified field in the database.
get_all_documents¶
get_all_documents: This function retrieves all documents from the specified database.
insert_many¶
insert_many: This function inserts multiple documents into the specified database.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| db_name | str | Name of the database | yes |
| data | list | List of documents to be inserted | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | list | List of results for each inserted document |
replace_one¶
replace_one: This function replaces a single document in the specified database based on a query.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| db_name | str | Name of the database | yes |
| query | dict | Query to select the document for replacement | yes |
| replace | dict | New document to replace the old one | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | dict | Contains the ID and new revision of the replaced document |
delete_one¶
delete_one: This function deletes a single document from the specified database based on a query.
| Input Parameter | Type | Description | Mandatory |
|---|---|---|---|
| db_name | str | Name of the database | yes |
| query | dict | Query to select the document for deletion | yes |
| Output Parameter | Type | Description |
|---|---|---|
| response | bool | Returns true if the document is deleted successfully |
delete_all¶
delete_all: This function deletes all documents from the specified database.
delete_many¶
delete_many: This function deletes multiple documents from the specified database based on a query.
delete_database¶
delete_database: This function deletes the specified database.
drop_connection¶
drop_connection: This function closes the active database connection.
Frequently Asked Questions¶
How do I configure CouchDB credentials in EasyTask?¶
Use the EasyTask vault system to securely store your CouchDB connection credentials. Navigate to the integration configuration page and add your host, port, username, and password under a vault key like couchdb/secret.
Can I use CouchDB with both EasyTask Cloud and On-Premises?¶
Yes, CouchDB works seamlessly with both EasyTask Cloud and On-Premises deployments. The configuration process is identical.
How do I troubleshoot CouchDB connection issues?¶
Check the integration server logs in EasyTask for detailed error messages. Verify your host, port, and credentials in the vault, ensure the CouchDB server is accessible from the integration server, and test connectivity using the built-in connection test feature.