在嵌套模式中从csv导入mongodb

时间:2018-02-07 03:57:41

标签: mongodb

我有csv文件

日期,dynmSpecMeta.regNo,dynmSpecMeta.vehRegNumber,路径,distCovered,fuelConsumption 2017-10-02,AZRPN5786K,MH 32 AQ 3189,路线10,10.8,1.15 2017-10-02,AYHPN5745L,MH 31 AQ 3474,Route 7,18.5,2.59 2017-10-02,AZRPN5783D,MH 33 AQ 1684,Route 14,11,1.48 2017-10-02,AZRPN5951P,MH 30 AQ 5833,路线8,5,0.68

这么多行...

我想将其导入已有的架构 -

var vahNityaSchema = new Schema({

updated: { type: Date, default: Date.now},

dynmSpecMeta: {
    date: Date,
    vehRegNumber: { type: String, required: false, unique: true},   // ref to vahAchar
    path: { type: String, required: false, unique: true},           // ref to vahPath
    regNo: { type: String, required: false, unique: true},          // ref to vahSarthi

    distCovered: Number, 
    fuelConsumption: Number,
}

})

我无法使用简单的mongoimport将其导入嵌套架构.... 请帮忙......

0 个答案:

没有答案