
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
bos-couchdb
Advanced tools
This is a CouchDB service for BlueOak Server. The service provides a convenient way of accessing couchdb servers through BlueOak Server. Under the covers the service uses nano.
$ npm install bos-couchdb
This service can be configured through the couchdb field of the BlueOak Server config.
Connections are named based on key specified in the connections
section of the couchdb config block.
The configuration below defines two connections, one to a remote Cloudant server named cloudant and another to a local couchdb server name local.
Each connection can include on more databases defined in the databases
field of the connection.
The key used will correspond to the name of an actual database on the couchdb server.
The configuration below defines two databases: profiles belonging to the cloudant connection, and devices belonging to the local connection.
"couchdb": {
"connections": {
"cloudant": {
"url": "https://example.cloudant.com/",
"username": "foo",
"password": "passw0rd",
"databases": {
"profiles": {}
}
},
"local": {
"url": "http://127.0.0.1:5984/",
"databases": {
"devices": {}
}
}
}
}
Scoped config are options that can be set on the root couchdb object, the connection, or the database. The database-specific value has precedence over the connection-specific value. The connection-specific value has precedence over the root value.
This allows the definition of global values that can be overridden as desired.
Valid options are:
The bos-couchdb service can be injected into services or handlers through a bosCouchdb
parameter on the init method.
exports.init = function(config, logger, bosCouchdb) {
...
}
The getConnection
function will return a named connection where connectionName corresponds to a connection specified in the configuration.
The nano database functions can be used on the connection object.
var conn = bosCouchdb.getConnection('local');
conn.list(function(err, results) {
//results is a list of databases on the connection
});
The get
function will return a database where dbName corresponds to a database defined in the configuration.
The nano document functions can be used on the db object.
var profilesDb = bosCouchdb.get('profiles');
profilesDb.get('foo' /*doc id*/, function(err, body) {
if (!err)
console.log(body);
});
Since it's possible that more than one connection will share a database name, the database name can be prefixed with the connection name. This will avoid any possible ambiguity in looking up a database.
var profilesDb = bosCouchdb.get('cloudant:profiles');
var devicesDb = bosCouchdb.get('local:devices');
FAQs
CouchDB service for BlueOak Server
The npm package bos-couchdb receives a total of 3 weekly downloads. As such, bos-couchdb popularity was classified as not popular.
We found that bos-couchdb 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.