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


#1

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

Pleaseeeee help!


#2

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


#3
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