npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

abacus-dbclient

v1.1.5

Published

API over a set of DB partitions

Downloads

44

Readme

abacus-dbclient

Distributes DB operations over a set of DB partitions with MongoDB backend.

Dependencies

The module is using mongodb native NodeJS driver.

Implementation

All functions exposed by the API open a collection and then translate the API to Mongo driver primitives.

get

Performs find with the specified _id. Returns the found document or undefined if not found (and not error!). The returned document has _rev set to 1 by default.

put

Performs:

  • update (with {upsert: true} option) if document with _rev is passed or
  • insertOne with the provided document

Returns the input document with id equal to _id and _rev set to 1 by default. Translates 11000 error code into 409 status.

remove

Calls deleteOne with the _id of the document. Returns the input document with id equal to _id and _rev with value from the stored document.

allDocs

Has two flavours based on the options passed. If startkey and endkey are present in the options calls the range variant. Otherwise uses the list one.

  • Range Uses find with:
    • { $gte: opt.startkey, $lte: opt.endkey }, or
    • { $gte: opt.endkey, $lte: opt.startkey } if descending: true
  • List Uses find with { $in: opt.keys }.

Both variants filter out the value field if include_docs: false. They return the found documents with id equal to _id and _rev set to 1 by default.

bulkDocs

Uses ordered bulk operation and:

  • adds in the bulk with upsert().updateOne operations for each document that has _rev
  • inserts with insert operation for document that has no specified _rev

Returns the input documents with id equal to _id and _rev set to 1 by default.

batch_get

Performs find with { $in: [ <id1>, <id2>, ... , <idN> ].

Filters out the value field if include_docs: false. Returns the found documents with id equal to _id and _rev set to 1 by default.

batch_put

Uses ordered bulk operation and:

  • adds in the bulk with upsert().updateOne operations for each document that has _rev
  • inserts with insert operation for document that has no specified _rev

Returns the input documents with id equal to _id and _rev set to 1 by default.

batch_remove

Uses deleteMany with all docs batched. Returns the found documents with id equal to _id and _rev set to 1 by default.