简体   繁体   中英

Connecting to a MongoDb in Node.js Error

Quite simply, I'm trying to connect to a MongoDB via Node.js:

Db = require('../v2/node_modules/mongodb').Db
Connection = require('../v2/node_modules/mongodb').Connection
Server = require('../v2/node_modules/mongodb').Server

console.log "before"
DbServer = new Server("localhost", 27017, {})
db = new Db("twitter", DbServer, {native_parser:true})
console.log "after"
return

That's my code and it's as simple as it gets. My output, however, seems to stop at the db = new Db... line.

在此输入图像描述

It never gets to the after. It doesn't give an error either. I know I have a DB running and when I fire up MongoHub, it's there along with the twitter database

只需删除native_parser = true即可

Native bson parser not compiled, please compile or avoid using native_parser=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM