Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@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.
The npm package @penname/slimgoose receives a total of 16 weekly downloads. As such, @penname/slimgoose popularity was classified as not popular.
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.