迭代对象作为通过邮递员工具发送的对象数组,并保存在数据库中

这是我通过邮递员工具发送的价值

{ "name" :[ { "first_name" : "antony", "second_name" : "grijan" },{ "first_name" : "suresh", "second_name" : "muthu" }], "allergy" : [ { "condition" : "headache" }, { "condition" : "toothache" }], "communication" : [ { "address" : "no 21 big street", "phone" : "84" }, { "address" : "no 43 small street", "phone" :"87" }] } 

我得到了我的控制层的价值,我试图把它保存在我的mongodb使用mongoose,我的模型代码是

 var mongoose = require('mongoose'); var Schema = mongoose.Schema; var patientSchema = new Schema({ name: { first_name : { type : String, default : ''}, second_name : { type : String, default : ''} }, allergy : { condition : {type : String, default : ''} }, communication : { address : {type : String, default : ''}, phone : {type : String, default : ''} } }); var patients = mongoose.model('Patients',patientSchema); module.exports = patients; 

我正在迭代的服务层代码是

 var addDao = require('../dao/dao'); var async = require('async'); module.exports.addPatient = function(detail,callback) { async.mapValues(detail,function(value,key,callback){ addDao.addPatient(value,function(data){ console.log(data); console.log("calling"); callback(null, data); }) }, function(err, result) { // result is now a map of results for each key console.log("inside func",result); callback(result); } ); } 

我有一个console.log()在我的服务层,但它只给我空值,我认为有我的模型代码或我的服务层迭代有问题! 在这里输入图像描述