Catalog npm
PACKAGE EXPLORERView in registry

0xdb

npm

Lightweight MongoDB key-value wrapper using Mongoose

databasekey-valuelightweightmongodbmongoosewrapper
Versions collected1
Direct dependencies1From release 0.0.1
Last observed20 Oct, 17:50 UTC

README

Current package documentation

0xdb

0xdb is a lightweight MongoDB key-value database wrapper built with Mongoose. Designed for simplicity and quick integration, it lets you store, retrieve, update, and delete key-value pairs in a MongoDB collection effortlessly.


🚀 Installation

npm install 0xdb

📦️ Usage

const { Schema, Database } = require("0xdb");

const mySchema = new Schema({
    username: String,
    balance: Number
});

const db = new Database({
    url: "mongodb://localhost/mydb",
    schema: mySchema,
    table: "users"
});

(async () => {
    await db.set("username", "ShadyMoon");
    await db.set("balance", 998204294765477899);

    console.log(await db.get("username")); // ShadyMoon
    console.log(await db.itemize()); // { username: "ShadyMoon", balance: 998204294765477899 }

    await db.update("balance", 1);
    console.log(await db.get("balance")); // 1

    await db.delete("username");
})();

📘 API

new Database(config)

Initialize the database with a config object:

  • url (String): MongoDB connection URI.
  • schema (Mongoose.Schema): Your Mongoose Schema.
  • table (String): Collection name.

set(key, value)

Sets or updates a key-value pair.

get(key)

Gets the value of a key.

delete(key)

Deletes a key-value pair. Returns true or false.

update(key, value)

Alias for set.

itemize()

Returns all stored values as a plain object.

keys()

Returns an array of all keys defined in the schema.


📄 License

MIT © ShadyMoon

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.0.1Registry latest11 May 20251

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
shadym00n/0xdb

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:50 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:b5eea1ad53657d3b5063a76b981c00085bd42d7367aad80f0f28dbd70ff2cde8