我是节点新手,一旦启动节点服务器就会出现以下错误。
*** API is running on environment: DEV - listening on port 3019!
Unhandled rejection MongoError: cannot index parallel arrays [occupations] [types]
at Function.MongoError.create (/var/www/api-dev/node_modules/mongodb-core/lib/error.js:31:11)
at /var/www/api-dev/node_modules/mongodb/lib/db.js:1096:80
at /var/www/api-dev/node_modules/mongodb-core/lib/connection/pool.js:469:18
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
字段 -
types:[
{type:String,require:true,index:true}
],
occupations:[
{
company:{type:Schema.Types.ObjectId,ref:"Company",index:true},
position:{type:String,require:false,index:true},
department:{type:String,require:false,index:true}
}
],
非常感谢任何帮助。提前谢谢。