@ydv/mongo

2.2.4 • Public • Published

@ydv/mongo

npm install --save @ydv/mongo

Exports db helpers and mongoose.

Expects process.env.MONGO_URL to be set for connection!!

const { db, Types, Model, Schema } = require('@ydv/mongo)

db; // db is just a copy of require('mongoose')

Types; // shorthand for mongoose.Schema.Types.
       // e.g. Types.ObjectId === mongoose.Schema.Types.ObjectId.

Model; // wrapper to create a mongoose model with some defaults/fixes for Lambda.

Schema; // wrapper to create a mongoose Schema with some defaults.

Find method in Model class is redifined so that all the find queries return a result equivaluent to find(args).lean().

Readme

Keywords

none

Package Sidebar

Install

npm i @ydv/mongo

Weekly Downloads

0

Version

2.2.4

License

none

Unpacked Size

3.08 kB

Total Files

3

Last publish

Collaborators

  • bdbuyertech
  • skag
  • ydvdev