
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
cache-mongodb
Advanced tools
$ npm install mongo-cache // with npm
$ yarn add mongo-cache // with yarn
$ pnpm add mongo-cache // with pnpm
// your-model.js
const { ModelWithCache } = require("mongo-cache");
const { Schema, model } = require("mongoose");
const yourSchema = new Schema({
name: String,
age: Number,
_id: String, // set id if you want to use it as cache key
});
const yourModel = model("YourModelName", yourSchema);
module.exports = new ModelWithCache(yourModel);
// idk.js
const model = require("../path/to/your-model");
async function maybeMain() {
// create document
const doc = await model.create({ name: "John", age: 20 });
// get all documents
const docs = await model.getAll(true); // true to skip cache
// get all documents with filter
const docs = await model.filter({ name: "John" }, true); // true to skip cache
// get document by id
const docById = await model.get(doc._id, true); // true to create if not exists
// get document by query
const docByQuery = await model.find({ name: "John" }, true); // true to create if not exists
// update document
const updatedDoc = await model.update(doc._id, { age: 21 });
/* or... */
doc.age = 21;
const updatedDoc = await model.update(doc._id, doc);
/* ❌ if you use <Document>.save(), the document won't be cached ❌ */
// delete document
await model.delete(doc._id);
// delete all documents
await model.deleteAll();
// delete all documents with filter
await model.deleteWithFilter({ name: "John" });
}
no se si tiene bugs xd
FAQs
Almacena en cache las bases de datos de MongoDB
The npm package cache-mongodb receives a total of 0 weekly downloads. As such, cache-mongodb popularity was classified as not popular.
We found that cache-mongodb 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.