所以,我是MEAN堆栈的新手,而且我试图播种MongoDB.我正在使用Mongoose与数据库进行通信,并且有大量文档表明我应该能够使用填充的JSON文件进行播种.
我尝试过的:
node-mongo-seed ; 非常简单,但在数组末尾始终抛出错误.(也许缺少的bson模块有问题?)
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
Seeding files from directory /Users/Antwisted/code/wdi/MEAN/seeds
----------------------
Seeding collection locations
err = [SyntaxError: /Users/Antwisted/code/wdi/MEAN/seeds/locations.json: Unexpected token {]
Run Code Online (Sandbox Code Playgroud)
猫鼬种子 ; 同样非常简单,基本上在导出到数据库之前将JSON对象放入变量中.有希望,但......更多错误......
Successfully initialized mongoose-seed
[ 'app/models/locationsModel.js' ]
Locations collection cleared
Error creating document [0] of Location model
Error: Location validation failed
Error creating document [1] of Location model
Error: Location validation failed
Error creating document [2] of …Run Code Online (Sandbox Code Playgroud)