
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@ifit/mongoose-clean
Advanced tools
Removes private vars, __v, and renames _id to id for mongoose documents
A plugin for Mongoose to normalize JSON output, as well as Object output. Based on mongoose-to-json
See CONTRIBUTING.md
Setup as a global plugin for all Mongoose schema's:
const mongoose = require("mongoose");
const clean = require("@ifit/mongoose-clean");
mongoose.plugin(clean);
Or for a specific (sub) schema:
const mongoose = require("mongoose");
const clean = require("@ifit/mongoose-clean");
const { Schema } = mongoose;
const MySchema = new Schema({});
MySchema.plugin(clean);
This plugin will normalize JSON output for client side applications from:
{
"_id": "400e8324a71d4410b9dc3980b5f8cdea",
"__v": 2,
"name": "Item A"
}
To a cleaner:
{
"id": "400e8324a71d4410b9dc3980b5f8cdea",
"name": "Item A"
}
You can also remove private paths from the JSON:
const mongoose = require("mongoose");
const toJson = require("@ifit/mongoose-clean");
const { Schema } = mongoose;
const schema = new Schema({
email: { type: String },
password: { type: String, private: true }
});
schema.plugin(toJson);
const User = mongoose.model("users", schema);
const user = new User({ email: "test@test.com", password: "test" });
console.log(user.toJSON());
This will output:
{
"id": "400e8324a71d4410b9dc3980b5f8cdea",
"email": "test@test.com"
}
FAQs
Removes private vars, __v, and renames _id to id for mongoose documents
The npm package @ifit/mongoose-clean receives a total of 13 weekly downloads. As such, @ifit/mongoose-clean popularity was classified as not popular.
We found that @ifit/mongoose-clean demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 49 open source maintainers 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.