Skip to content

Instantly share code, notes, and snippets.

@brunokrebs
Created October 30, 2017 11:17
Show Gist options
  • Select an option

  • Save brunokrebs/3d9a2a471ca10166dbb5d9ef1825b9a8 to your computer and use it in GitHub Desktop.

Select an option

Save brunokrebs/3d9a2a471ca10166dbb5d9ef1825b9a8 to your computer and use it in GitHub Desktop.
Webtask and MongoDB
var parallel = require('async').parallel;
var MongoClient = require('mongodb@2.2.33').MongoClient;
module.exports = function (ctx, done) {
var url = 'mongodb://bkrebs:123123@ds135410.mlab.com:23410/brunokrebsauth0'
MongoClient.connect(url, function (err, db) {
if(err) return done(err);
db.collection('test').insertOne({
name: 'Bruno Krebs@2.2.33',
time: new Date()
}, done);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment