Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
monastery
Advanced tools
v3.0 has been released 🎉 refer to breaking changes below when upgrading from v2.x.
This repository is distributed with NPM. After installing NPM, you can install Monastery via:
$ npm install --save monastery
import db from 'monastery'
// Initialize a monastery manager
db.manager('localhost/mydb')
// Define a model
db.model('user', {
fields: {
name: { type: 'string' },
pets: [{ type: 'string' }],
address: { city: { type: 'string', minLength: 10 } },
points: [[{ type: 'number' }]]
}
})
// Insert some data
try {
const newUser = await db.user.insert({
data: {
name: 'Martin Luther',
pets: ['sparky', 'tiny'],
address: { city: 'Eisleben' },
points: [[1, 5], [3, 1]]
}
})
} catch (errs) {
// [{
// detail: "Value needs to be at least 10 characters long.",
// status: "400",
// title: "address.city",
// meta: {
// field: "city",
// model: "user",
// rule: "minLength"
// }
// }]
}
You can view MongoDB's compatibility table here, and see all of MongoDB NodeJS Driver releases here
Monastery | Mongo NodeJS Driver | MongoDB Server | Node |
---|---|---|---|
3.x | 5.9.x | >=3.6 <=7.x | >=14.x <=latest |
2.x | 3.7.x | >=2.6 <=6.x | >=4.x <=14.x |
{ acknowledged: true, matchedCount: 1, modifiedCount: 1, upsertedCount: 0, upsertedId: null }
instead of { n: 1, nModified: 1, ok: 1 }
{ acknowledged: true, deletedCount: 1 }
, instead of { results: {n:1, ok:1} }
afterFind: [async (data) => {...}]
books[].title
are now validated, and don't replace the whole object, e.g. books
db()
moved to db.manager()
monastery(mongoClient)
, handy for migrate-mongotimestamps
opt), and can be switched off via blacklistingrequired
model.count()
This package uses debug which allows you to set the level of output via the DEBUG
environment variable. Using DEBUG
will override the manager's logLevel
option, e.g. monastery('...', { logLevel: 3 })
.
$ DEBUG=monastery:error # level 1, shows errors
$ DEBUG=monastery:warn # level 2, shows warnings and depreciation notices
$ DEBUG=monastery:info # level 3, shows operation information
All pull requests are welcome. To run isolated tests with Jest:
npm run dev -- -t 'Model indexes'
Copyright 2024 Ricky Boyce. Code released under the MIT license.
FAQs
⛪ A simple, straightforward MongoDB ODM
We found that monastery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.