
Security News
AI Slop Is Polluting Bug Bounty Platforms with Fake Vulnerability Reports
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.
couchdb-iterator
Advanced tools
A fast and easy to ease CouchDB iterator for views and all documents
A fast and easy to ease CouchDB iterator for views and all documents.
$ npm install couchdb-iterator
couchdbIterator(couchdbAddr, [view], iterator, [options])
Calls iterator
for each row of the database referenced by couchdbAddr
.
If a view
is supplied, iterates only over that view's rows.
This library aims to be fast, therefore iteration happens concurrently. The iterator function can be async but beware that order is not guaranteed.
Examples:
const couchdbIterator = require('couchdb-iterator');
// Iterate over all rows of a database
couchdbIterator('http://localhost:5984/my-db', (row, index) => {
console.log(index, row.id, row.key, row.value);
// Do something with `row`; you may return a promise here
})
.then((rowsCount) => {
console.log(`Iteration completed! ${rowsCount}`);
}, (err) => {
console.log('Iteration failed', err);
});
// Iterate over all rows of a view
couchdbIterator('http://localhost:5984/my-db', 'my-design-doc/my-view', (row, index) => {
console.log(index, row.id, row.key, row.value);
// Do something with `row`; you may return a promise here
})
.then((rowsCount) => {
console.log(`Iteration completed! ${rowsCount}`);
}, (err) => {
console.log('Iteration failed', err);
});
The couchdbAddr
argument must be a connection string with protocol, host, port and database path (e.g.: http://localhost:5984/my-db) or a nano instance. The view
argument is a string in the form of design-doc/view-name
(e.g.: app/byUser).
Available options:
concurrency
: The concurrency in which the iterator
is called, defaults to 50
.nano
: Custom options to be used when creating the nano instance, defaults to null
.limit
, skip
, stale
, descending
, startkey
, startkey_docid
, endkey
, endkey_docid
, include_docs
and inclusive_end
(can be camelCased).All querying options have no default value, except for limit
which is concurrency * 10
. Also, stale
is automatically set to ok
after the first iteration to further improve performance.
couchdbIterator.bulk(couchdbAddr, [view], iterator, [options])
Calls iterator
for a bulk of rows of the database referenced by couchdbAddr
.
If a view
is supplied, iterates only over that view's rows.
This method is similar to couchdbIterator()
but iterates in bulks and it respects the order of rows. The order is respected because since a bulk is ordered and the next bulk only comes when the current bulk is handled.
Examples:
const couchdbIterator = require('couchdb-iterator');
// Iterate over all rows of a database
couchdbIterator.bulk('http://localhost:5984/my-db', (rows) => {
rows.forEach((row) => {
console.log(row.index, row.id, row.key, row.value);
});
// Do something with `rows`; you may return a promise here
})
.then((rowsCount) => {
console.log(`Iteration completed! ${rowsCount}`);
}, (err) => {
console.log('Iteration failed', err);
});
// Iterate over all rows of a view
couchdbIterator.bulk('http://localhost:5984/my-db', 'my-design-doc/my-view', (rows) => {
rows.forEach((row) => {
console.log(row.index, row.id, row.key, row.value);
});
// Do something with `rows`; you may return a promise here
})
.then((rowsCount) => {
console.log(`Iteration completed! ${rowsCount}`);
}, (err) => {
console.log('Iteration failed', err);
});
The couchdbAddr
argument must be a connection string with protocol, host, port and database path (e.g.: http://localhost:5984/my-db) or a nano instance. The view
argument is a string in the form of design-doc/view-name
(e.g.: app/byUser).
Available options:
bulkSize
: The bulkSize, defaults to 50
.nano
: Custom options to be used when creating the nano instance, defaults to null
.limit
, skip
, stale
, descending
, startkey
, startkey_docid
, endkey
, endkey_docid
, include_docs
and inclusive_end
(can be camelCased).All querying options have no default value, except for limit
which is bulkSize * 10
. Also, stale
is automatically set to ok
after the first iteration to further improve performance.
$ npm test
$ npm test-cov
to get coverage report
The tests expect a running CouchDB in http://localhost:5984
and will create and destroy couchdb-iterator-tests
database. You may specify a different address with COUCHDB
, e.g.: $ COUCHDB=http://admin:admin@localhost:5984/my-custom-database-for-tests npm test
.
Released under the MIT License.
FAQs
A fast and easy to ease CouchDB iterator for views and all documents
The npm package couchdb-iterator receives a total of 70 weekly downloads. As such, couchdb-iterator popularity was classified as not popular.
We found that couchdb-iterator 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
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.
Research
Security News
The Socket Research team investigates a malicious Python package disguised as a Discord error logger that executes remote commands and exfiltrates data via a covert C2 channel.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.