一旦nodejs启动就获得mongoerror

时间:2018-03-20 11:30:26

标签: node.js mongodb mongoose

我是节点新手,一旦启动节点服务器就会出现以下错误。

*** 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}
            }
        ],

非常感谢任何帮助。提前谢谢。

0 个答案:

没有答案
相关问题