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

@djs-commands/adapter-mongoose

v2.0.1

Published

Mongoose Storage adapter for djs-commands — MongoDB-backed persistent state

Readme

@djs-commands/adapter-mongoose

Mongoose/MongoDB Storage adapter for @djs-commands/core.

Persists the framework's three built-in models — guild prefixes, disabled commands, and channel locks. This is the v1 (@d3oxy/djs-commands) continuity path — v1 was Mongo-first.

📘 Full walk-through: https://djscommands.deoxy.dev/adapter-cookbook#mongoose-mongodb

The adapter targets mongoose@^8. v1 was on mongoose@^7; the breaking changes between the two are documented in Mongoose's migrating-to-8 guide.

Install

bun add @djs-commands/core @djs-commands/adapter-mongoose mongoose

mongoose and @djs-commands/core are peer dependencies — install them in your app.

Usage

Pass a Mongoose Connection (created with mongoose.createConnection(url)) into mongooseStorage, then hand the returned Storage to your command handler.

import { Client, GatewayIntentBits } from "discord.js";
import { createCommandHandler } from "@djs-commands/core";
import { mongooseStorage } from "@djs-commands/adapter-mongoose";
import mongoose from "mongoose";

const connection = mongoose.createConnection(process.env.MONGO_URL!);
await connection.asPromise();

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

createCommandHandler({
  client,
  commands: [/* ... */],
  storage: mongooseStorage(connection),
});

await client.login(process.env.DISCORD_TOKEN);

The adapter lazy-creates the framework models on the connection the first time each is needed. Mongoose caches models by name on the connection, so re-instantiating the storage with the same connection is cheap.

Bring-your-own-models

If you've already registered compatible models on the connection (e.g. to share with other code), pass them explicitly:

import {
  createGuildPrefixModel,
  createDisabledCommandModel,
  createChannelLockModel,
  mongooseStorage,
} from "@djs-commands/adapter-mongoose";

mongooseStorage(connection, {
  models: {
    guildPrefix: createGuildPrefixModel(connection),
    disabledCommand: createDisabledCommandModel(connection),
    channelLock: createChannelLockModel(connection),
  },
});

Coming from v1?

@d3oxy/[email protected] is preserved at the v1-final-commit git tag and is no longer maintained. Your existing Mongoose connection works as-is — see the v1 → v2 migration guide for the rest.

Local development

Spin up MongoDB for testing:

docker run --rm -p 27017:27017 mongo:7
MONGO_URL=mongodb://localhost:27017/djs-commands-test bun test

The integration test suite skips cleanly if MONGO_URL is unset or unreachable — CI without Mongo will not fail.

License

MIT · Issues + discussions on GitHub.