title: how to establish the connection between nodejs and mongodb on aws lambda?
body: <p>I am using MongoDB database and Aws lambda function in my project. When  i tried access Mongodb dataabse through Aws lambda node js function, i get some error. find the below code</p>
  
  <pre><code>var MongoClient = require('mongodb').MongoClient;
  var url = "mongodb://username:password@localhost:27017/";
  
  MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  });
  </code></pre>
  
  <p>I get some error like this below:</p>
  
  <pre><code>Response:
  {
  "errorMessage": "Cannot find module 'mongodb'",
  "errorType": "Error",
  "stackTrace": [
  "Function.Module._load (module.js:474:25)",
  "Module.require (module.js:596:17)",
  "require (internal/module.js:11:18)",
  "Object.&lt;anonymous&gt; (/var/task/index.js:1:81)",
  "Module._compile (module.js:652:30)",
  "Object.Module._extensions..js (module.js:663:10)",
  "Module.load (module.js:565:32)",
  "tryModuleLoad (module.js:505:12)",
  "Function.Module._load (module.js:497:3)"
  </code></pre>
  
  <p>]
  }</p>
  
  <p>How to connect mongdb and aws lambda function through node.js???</p>