[SOLVED]Connect to Meteor App's MongoDB from a pure node.js app

I need to connect to the mongodb of my app from a non meteor app (node.js app)

Pleaseeeee help!

Use the MongoDB Node.js driver: https://mongodb.github.io/node-mongodb-native/

var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:3001/";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  db.createCollection("customers", function(err, res) {
    if (err) throw err;
    console.log("Collection created!");
    db.close();
  });
});

logs db.createCollection() is not a Function… even db.collection(‘users’) logas the same

1 Like