Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
couchdb-utils
Advanced tools
Readme
To install via NPM type the following: npm install couchdb-utils
You can also install via git by cloning: git clone https://github.com/paseek/couchdb-utils.git /path/to/your/dir
Create a database if it doesn't exist:
var cradle = require('cradle'),
cutils = require('couchdb-utils');
var db = new (cradle.Connection)().database('my-db');
db.createIfNotExists(function(err, existed) {
if (!err && !existed) console.log('The database has been successfully created.');
});
Manage versioning and updates of couchdb design documents: (based on grave project).
var cradle = require('cradle'),
cutils = require('couchdb-utils');
var db = new (cradle.Connection)().database('my-database');
var design = new cutils.Design(db, 'my-view', '0.0.2');
design.view('all', {
map : function (doc) {
if (doc.type === 'my-doc') emit(doc._id, 1);
}
});
design.end(function(err) {
console.log('all views are up-to-date');
});
new Design(db, name, version)
Create a design with a name
and a version
.
db
is an instance of cradle.Database.
Theversion
should be understood by
semver.
var cradle = require('cradle'),
cutils = require('couchdb-utils');
var db = new (cradle.Connection)().database('my-database');
var design = new cutils.Design(db, 'my-view', '0.0.2');
design.view(name, view)
Define a couchdb view. CouchDB views have map
, reduce
, and fields of that
sort.
design.view('all', {
map : function (doc) {
if (doc.type === 'my-doc') emit(doc._id, 1);
}
});
design.list(name, list)
Define a couchdb list. CouchDB lists are functions that look like
function (head, req) { /* ... */ }
.
design.update(name, update)
Define a couchdb update. These look like function (doc, req) { /* ... */ }
.
design.end(callback)
Declare the end of the design document definitions and save them to couchdb when the design version is greater than the couchdb version.
design.end(function(err) {
console.log('all views are up-to-date');
});
FAQs
CouchDB utils
The npm package couchdb-utils receives a total of 2 weekly downloads. As such, couchdb-utils popularity was classified as not popular.
We found that couchdb-utils 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.