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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@webtypen/webframez-dbdriver-mongodb

v0.0.14

Published

Adds mongodb support/driver to an webtypen-webframez application

Readme

webframez MongoDB Driver

Registration:

app.ts:

import { WebApplication, DBDrivers } from "@webtypen/webframez-core";
import { MongoDBDriver } from "@webtypen/webframez-dbdriver-mongodb";

// ...
DBDrivers.register("mongodb", MongoDBDriver);
// ...

const app = new WebApplication();
app.boot();

Backups

The driver implements the Webframez backup(client, options) hook by running mongodump.

Server requirements:

mongodump --version

On Ubuntu, install it through MongoDB Database Tools if it is missing.

Example Webframez backup source:

databases: [
  {
    connection: "default",
    to: "database/mongodb",
    options: {
      gzip: true
    }
  }
]

MongoDB 6 upgrade (0.0.10)

Requires Node.js >=16.20.1. Upgrade webframez-core to >=0.3.68 together with this release to keep the standard queue worker compatible with empty queues. The driver uses MongoDB ^6.21.0; align the application dependency with that version to avoid mixing BSON implementations. See CHANGELOG.md for API changes.

Core database decoupling (0.0.11)

This release implements the core's idAdapter and documentStore(client) capabilities. Native BSON IDs, collections, cursors and atomic claims live in this package. MongoDB remains a runtime dependency here; core 0.3.69 no longer installs it.

For a staged upgrade from core 0.3.68 / driver 0.0.10, update this driver first, then update core to 0.3.69. The existing driver methods remain available to core 0.3.68. Core 0.3.69 requires driver >=0.0.11 for the new capabilities. Applications with native MongoDB imports must keep their own compatible mongodb dependency. No database migration is needed.

documentStore(...).collection(...).findOneAndUpdate(...) explicitly requests includeResultMetadata: false and returns a document or null, including when a document itself contains a value property. Claims use one atomic MongoDB operation, preserving concurrency protection for queue workers and notifications.

Run unit tests with npm test. To include integration tests against a fresh, isolated temporary database (never the application's configured database):

WEBFRAMEZ_TEST_MONGOD=/usr/bin/mongod \
WEBFRAMEZ_TEST_CORE=/absolute/path/to/webframez-core/dist/index.js npm test

Build core first. The integration test covers CRUD, DataBuilder saves, Datatable selection, concurrent atomic updates, embedded queue execution and notification claims. It creates a temporary data directory and loopback listener, and removes them afterward.

Manager/document models (0.0.12)

MongoDBModel and MongoDBTimeSeriesModel implement the same model operation contract as the SQLite/DuckDB drivers: projections, object filters, atomic conditional updates, upserts, index creation, aggregation and telemetry history. Configure idStrategy: "preserve" for applications such as Server Manager that use UUID/custom/numeric IDs; the default ObjectId strategy remains unchanged.

Optional undefined object properties are omitted from document-model write payloads, and $set of undefined removes that field. Query and tenant filters are never stripped. Explicit null, false, zero and empty strings retain their meaning. Manager-mode reads promote binary data to Buffer and BSON int64 to bigint.

Telemetry works on an existing standalone MongoDB. A single atomic series head commits a bounded pending sample; idempotent writes materialize historical metric rows before accepting the next sample. Reads replay interrupted pending batches, and history is bounded by the captured head. No replica set or extra MongoDB instance is required. timeSeries operation flush completes pending batches before an offline transfer.

To run the additional integration tests against an existing local service: WEBFRAMEZ_TEST_MONGODB_URL=mongodb://127.0.0.1:27017 npm test. They create and remove only uniquely named webframez_driver_test_* databases. Do not set the legacy WEBFRAMEZ_TEST_MONGOD variable when the environment prohibits additional mongod instances.

Bounded telemetry retention (0.0.14)

The time-series contract is version 2 (MongoDBTimeSeriesModel.capabilities()). maintain(ownerId, seriesId, now, {maxBuckets: 4, maxDurationMs: 100}) returns {more, oldestDueAt, processed}; continue in a later call while more is true. Expiry and compaction both process bounded timestamp windows. The time budget is cooperative, and pending bucket commits remain replayable on standalone MongoDB. retentionStatus(ownerId, seriesId, now) reads backlog without advancing it; series(limit, {ownerId, seriesId}) supports paging through scopes.