title: Insert data using Node-red to external mongoDB
body: <p>I'm new at Node-Red &amp; Javascript.</p>
  
  <p>I'm trying to insert some "key:value" to external MongoDB (not the MongoDB inside the Node-red but rather external one using mlab.com service).</p>
  
  <p>I've got from mlab (who holds the DB for me) link to insert some data to my db. I looked for "how to insert data to mlab using JS" and this what I found:</p>
  
  <pre><code>var MongoClient = require('mongodb').MongoClient;
  var url = "mongodb://&lt;dbuser&gt;:&lt;dbpassword&gt;@*******.mlab.com:****/*****";
  
  MongoClient.connect(url, function(err, db) {
    if (err) throw err;
    var dbo = db.db("mydb");
    var myobj = { name: "Company Inc", address: "Highway 37" };
    dbo.collection("customers").insertOne(myobj, function(err, res) {
      if (err) throw err;
      console.log("1 document inserted");
      db.close();
    });
  });
  </code></pre>
  
  <p>The main problem is (according to what I have understood) Node-red isn't use "require()" (some import of JS) but some of global function that replace the "require()" part. If I'm trying to use "require()" the error:"ReferenceError: require is not defined (line 1, col 19)" appears. 
  I have no idea how to implements the globalFunction and replace the "require()" job.</p>
  
  <p>My question is: how I'm sending data using this link that I've received from mlab.com without using "require()" from Node-Red?</p>