Socket
Socket
Sign inDemoInstall

easymongoosedb

Package Overview
Dependencies
3
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    easymongoosedb

Easily setup a mongo database connection using Mongoose


Version published
Weekly downloads
1
Maintainers
1
Install size
1.00 MB
Created
Weekly downloads
 

Readme

Source

EasyMongooseDB

EasyMongooseDB takes a lot of the make work around quickly setting up a connection to a MongoDB database with Mongoose, as well as providing helpful functions around models and schema creation.

Installation

npm install easymongoosedb

Example Usage

Connection to a database

var easydb = require('easymongoosedb');

var db = easydb({
	url: 'mongodb://127.0.0.1:27017/testdb', // Path to your database
	type: 'single', // Can be set/single
	modelsDir: path.join(__dirname, 'schemas') // Path to the schemas
});

db.connect(function(err) {
	
});

Getting a model

// Async
db.getModel('user', function(err, User) {
	User.find(...);
});

// Get many models
db.getModels(['user', 'invoices'], function(err, User, Invoices) {
	
});

// Sync
var User = db.getModelSync('User');

Namespacing

EasyMongooseDB provides the ability to created use a single schema to create many namespaced models (useful for creating instanced collections).

TODO - Add details

License

EasyMongooseDB is distributed under an MIT License_

FAQs

Last updated on 07 Aug 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc