
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
hapi-mongo-models
Advanced tools
A hapi plugin for mongo-models
.
$ npm install hapi-mongo-models
During plugin registration we connect to MongoDB using the supplied options.
During Hapi's onPreStart
server extension point and based on your autoIndex
option, we create any indexes defined in the models
supplied.
const HapiMongoModels = require('hapi-mongo-models');
const plugin = {
plugin: HapiMongoModels,
options: {
mongodb: {
connection: {
uri: 'mongodb://localhost:27017/',
db: 'hapi-mongo-models-test'
},
options: {}
},
models: [
'./path/to/customer',
'./path/to/order'
],
autoIndex: false
}
};
await server.register(plugin);
The options passed to the plugin is an object where:
mongodb
- is an object where:
connection
- is an object where:
uri
- a string representing the connection uri for MongoDB.db
- the name of the database.options
- an optional object passed to MongoDB's native connect function.autoIndex
- a boolean specifying if the plugin should call createIndexes
for each model that has a static indexes
property. Defaults to true
.
Typically set to false
in production environments.models
- an array strings representing the paths to the models (relative to
the current working directory or absolute) of where to find the model on
disk.Any issues or questions (no matter how basic), open an issue. Please take the initiative to read relevant documentation and be pro-active with debugging.
Contributions are welcome. If you're changing something non-trivial, you may want to submit an issue before creating a large pull request.
Note: This plugin is designed for basic use-cases. If you find yourself needing more, consider using the source as inspiration and create a custom plugin for your app.
MIT
What you create with hapi-mongo-models
is more important than hapi-mongo-models
.
FAQs
A hapi plugin for mongo-models
We found that hapi-mongo-models 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
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.