javascript - MongoDB -- client.open() returns "undefined in not a function" -


here's have:

var express = require('express');  var mongoclient = require('mongodb').mongoclient;  var server = require('mongodb').server;    var app = express();    var client = new mongoclient(new server('localhost', 27017, {}), {});    client.open(function(err, client){  //callback  });

and when run it, points line open method on , says "undefined not function". doing wrong?

from mongo docs :

var mongoclient = require('mongodb').mongoclient  // connection url var url = 'mongodb://localhost:27017/myproject'; // use connect method connect server mongoclient.connect(url, function(err, db) {   console.log("connected correctly server");    db.close(); }); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -