SHARE
TWEET

Untitled

a guest Jan 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const MongoClient = require('mongodb').MongoClient;
  2. const assert = require('assert');
  3.  
  4. // Connection URL
  5. const url = 'mongodb://localhost:27017';
  6.  
  7. // Database Name
  8. const dbName = 'myproject';
  9.  
  10. // Create a new MongoClient
  11. const client = new MongoClient(url);
  12.  
  13. var banco;
  14. // Use connect method to connect to the Server
  15. client.connect(function(err) {
  16.     assert.equal(null, err);
  17.     console.log("Connected successfully to server");
  18.  
  19.     banco = client.db(dbName);
  20. });
  21.  
  22. module.exports = banco;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top