Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@penname/slimgoose
Advanced tools
A convenient, slim Mongoose interface to MongoDB for getting your data layer up and running quickly and cleanly.
A convenient, slim Mongoose interface to MongoDB for getting your data layer up and running quickly and cleanly. Leverages a clonable schema builder.
This module is still under development, but it's well tested, so feel free to take it for a spin.
The following is a simple example of how to initiate your mongoose via slimgoose, connect to your mongodb database, create a mongoose model via slimgoose, and use your model.
// index.js
// Setup your mongoose
const slimgoose = require('slimgoose')
const Q = require('q')
slimgoose.use(require('mongoose')) // Optional
slimgoose.usePromiseClass(Q) // Optional
// Connect to your mongodb
slimgoose.connect(mongoDbUri, { mongooseOptionA: 'bar' })
// models/userModel.js
const slimgoose = require('slimgoose')
// Create a mongoose model from a schema
const User = slimgoose
.schema({
name: String,
email: { type: String, require: true },
username: { type: String, index: true },
})
.staticMethods({
insertNew(data) {
return new User(data).save()
},
findByUsername(username) {
return this.find({ username })
},
load({ from, limit }) {
const query = { username: { $gte: from } }
return this.find(query).limit(limit).exec()
},
})
.toModel('user')
module.exports = User
Use your model in an operation file to interface with your mongodb data.
// operations/User.js
const User = require('../models/userModel')
module.exports = {
getUserByUsername(username) {
return User.findByUsername(username)
},
}
We're still in the process of adding documentation, so please reference the tests for more functionality.
Contributions are welcomed. This is how you get started:
npm install
npm test
FAQs
A convenient, slim Mongoose interface to MongoDB for getting your data layer up and running quickly and cleanly.
We found that @penname/slimgoose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.