
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
couchdb-wrapper
Advanced tools
A wrapper for sync and async interaction with a CouchDB instance
This module provides a simple wrapper class for couchdb requests.
Using npm:
$ npm install --save couchdb-wrapper
Using bower:
$ bower install --save couchdb-wrapper
Using Script-Tag: *
<script src="https://raw.githubusercontent.com/MCStreetguy/couchdb-wrapper/master/dist/couchdb-wrapper.min.js" charset="utf-8"></script>
Using short URL Script-Tag: *
<script src="https://goo.gl/1YrYHF" charset="utf-8"></script>
(* functionality is not granted!)
This is currently missing any documentation about the babel-compiled module. Explanations below refer to the Node.js module provided in this package.
Require the module:
import CouchDB from 'couchdb-wrapper';
Create a new instance:
var db = new CouchDB({
host: 'your database server',
port: '5984 by default',
username: 'login username',
password: 'login password'
});
All options have to be set, otherwise an error will be thrown.
username
and password
can be empty strings if you don't need authentication on your CouchDB server.
All functions are available as synchronous and asynchronous versions. If the callback parameter is provided and a function, the call will be made asynchronously. Otherwise the request is sent synchronously.
Please notice! Synchronous requests block the execution of code which creates "freezing" on the screen and an unresponsive user experience. Source (MDN)
But since this leads straightly into "callbacks of doom" (endless nesting of callback functions) a little hint: Firing the first function (info or allDbs is always a good start for this) asynchronously splits the execution from the main process. Therefore you may use synchronous calls within a callback without freezing.
The following object scheme is provided to the callback or returned by the function, depending on the asynchrony.
Key | Description |
---|---|
status | 'done' if the request succeeded, 'pending' if the request still has to be processed by the server or 'error' if the request failed. |
code | Exposes the requests http-status-code as number (e.g. for further comparison). |
msg | Contains a readable status message or an empty string if unnecessary. |
response | The response data or undefined . |
Returns server information.
Recieve all accessible databases stored on the server.
Recieve a database object from the server.
identifier
: The name of the database.
Create a new database on the server.
identifier
: The name of the database.
Recieve all documents within the given database.
identifier
: The name of the database
Store an object in the given database.
identifier
: The name of the database
data
: The object that should be stored in the database. If it contains _id
the document will be stored under that ID, otherwise a new ID is generated and returned in the response.
Store an object in the given database.
identifier
: The name of the database
docIdentifier
: The uid of the document
Store an object in the given database.
identifier
: The name of the database
docIdentifier
: The uid of the document
revision
: The latest revision id of the document
Store an object in the given database.
identifier
: The name of the database
docIdentifier
: The uid of the document
newdata
: The new data to be written
(newdata.rev
: must contain the latest revision id)
The following functions are intended as helper methods and can only be called on the Class itself, not an instance of the Class.
Parses a revision id into an integer value representing the version count.
revision
: The revision identifier
Validates a revision id. Returns true if it matches the following RegExp:
/^([0-9]+-[a-z0-9]+)/
revision
: The revision identifier
FAQs
A wrapper for sync and async interaction with a CouchDB instance
The npm package couchdb-wrapper receives a total of 7 weekly downloads. As such, couchdb-wrapper popularity was classified as not popular.
We found that couchdb-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.