簡體   English   中英

在Node.js錯誤中連接到MongoDb

[英]Connecting to a MongoDb in Node.js Error

很簡單,我正在嘗試通過Node.js連接到MongoDB:

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

這是我的代碼,它就像它得到的一樣簡單。 但是,我的輸出似乎停在db = new Db...行。

在此輸入圖像描述

它永遠不會到達后。 它也沒有給出錯誤。 我知道我有一個DB運行,當我啟動MongoHub時,它與twitter數據庫一起存在

只需刪除native_parser = true即可

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM