Failed to connect to mongodb database

  mongodb, question

Mongodb version 3.2, node installed mongodb driver module version is 1.4.15, by the way failed to load c++bson extension, using pure jsversion, this installed BSON, node-gyp has no effect = =

C:\Users\Administrator\blog>node app.js
 Failed to load c++ bson extension, using pure JS version
 Express server listening on port 3000
 C:\Users\Administrator\blog\node_modules\connect-mongo\lib\connect-mongo.js:178
 throw err;
 ^
 
 Error: Error connecting to database: failed to connect to [localhost:27017]
 at null.<anonymous> (C:\Users\Administrator\blog\node_modules\connect-mongo\
 node_modules\mongodb\lib\mongodb\connection\server.js:553:25)
 at emitThree (events.js:97:13)
 at emit (events.js:175:7)
 at null.<anonymous> (C:\Users\Administrator\blog\node_modules\connect-mongo\
 node_modules\mongodb\lib\mongodb\connection\connection_pool.js:140:15)
 at emitTwo (events.js:87:13)
 at emit (events.js:172:7)
 at Socket.<anonymous> (C:\Users\Administrator\blog\node_modules\connect-mong
 o\node_modules\mongodb\lib\mongodb\connection\connection.js:512:10)
 at emitOne (events.js:77:13)
 at Socket.emit (events.js:169:7)
 at emitErrorNT (net.js:1250:8)

Once it’s done, the bug can be divided into two parts: failed to load c++bsonextension, using pure jsversion. this part requires npm1nstall node-gyp-g to be dead or alive, or minutes.
Then you need to open the mongodb database, and the command line path goes under mongodb’s bin.
Manually set the project database path mongod.exe you want-dbpathc: \ data \ blog
Then in the package.json of the project

"mongodb":"latest",
 "express-session":"latest",
 "connect-mongo":"latest",
 "mongoose":"latest"

Install these versions up to date, or else you will still report an error.
Start again and you’re done ~ ~ ~