I just started to learn mongodb. I tried the following code in my app.js
var databaseUrl = "localhost:27017/pixelmargin"; // "username:[email protected]/mydb"
var collections = ["pages"]
var mongojs = require("mongojs");
var db = mongojs.connect(databaseUrl)
But I get the following error:
Uncaught TypeError: undefined is not a function ' error occurs on line 'var db = mongojs.connect(databaseUrl)
According to the documentation there is no .connect()
You select the db via the following:
var mongojs = require("mongojs");
var db = mongojs("dbname");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With