0.3.4 • Published 8 months ago

@1mill/mongo v0.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@1mill/mongo

Reuse MongoDB connections between AWS Lambda invocations.

Getting started

npm install @1mill/mongo
const { Mongo } = require('@1mill/mongo')

const mongo = new Mongo({
  db: 'my-database-name',
  uri: 'mongodb://my-username:my-password@my-mong-host-name:27017/my-database-name',
})

exports.handler = async (cloudevent = {}, ctx = {}) {
  ctx.callbackWaitsForEmptyEventLoop = false

  const { db } = await mongo.connect()

  const collection = db.collection('my-collection-name')
  await collection.createIndex({ something: 1 })
  await collection.insertOne({ something: 'yes' })
}
NameRequiredDefaultNotes
dbprocess.env.MILL_MONGO_DB
options{}useNewUrlParser and useUnifiedTopology enabled by default
uriyesprocess.env.MILL_MONGO_URI

Deploying

  1. Commit changes
  2. Run npm version (major|minor|patch)
  3. Run git push
  4. Run npm run deploy
0.1.0

8 months ago

0.3.0

8 months ago

0.2.0

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.4

8 months ago

0.3.3

8 months ago

0.0.5

2 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago