I followed the "Basic Introduction to MongoDB" from (http://mongodb.github.com/node-mongodb-native/api-articles/nodekoarticle1.html)
I installed node-v0.8.21 from sources to this directory "/home/myuser/lib/node/" (I'am not root on the machine)
I set the proxy for npm and launched this command to install "mongodb" driver: "./npm install mongodb"
The command returned in success and produced a mongodb directory in "/home/myuser/lib/node/bin/node_modules/".
I don't know how to use the driver now.. I tried this:
// Retrieve
var MongoClient = require('mongodb').MongoClient;
// Connect to the db
MongoClient.connect("mongodb://localhost:27017/exampleDb", function(err, db) {
if(!err) {
console.log("We are connected");
}
});
But I always have this error code: "Uncaught ReferenceError: require is not defined"
Thanks in advance,