【发布时间】:2018-04-07 18:42:39
【问题描述】:
尝试在 mongoose 的帮助下使用 Employee 数据填充 mongo 数据库。当运行为: node populate_db.js 时,它会抛出一个错误,说
module.js:471
throw err;
^
Error: Cannot find module 'mongodb/node_modules/bson'
无法检查数据库值,因为数据库似乎也是空的。
这是我的 package.json 文件:
{
"name": "hr",
"version": "1.0.0",
"description": "first node app server",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pereiraryan/domains.git"
},
"keywords": [
"domains"
],
"author": "ryan pereira",
"license": "ISC",
"bugs": {
"url": "https://github.com/pereiraryan/domains/issues"
},
"homepage": "https://github.com/pereiraryan/domains#readme",
"dependencies": {
"async": "^2.5.0",
"mongoose-post-find": "0.0.2",
"colors": "^1.1.2",
"debug": "0.7.4",
"express": "4.2.0",
"mongoose": "^3.8.11"
} ,
"scripts": {
"populate": "node ./bin/populate_db"
}
}
【问题讨论】:
标签: javascript node.js mongodb mongoose mean-stack