我正在使用 Raven 的 SQL 复制工具将我们的 Raven DB 文档复制到 SQL 中,并且到目前为止只遇到了几个问题。我现在已经开始处理我们最复杂的文档之一,并努力寻找在包含多列的文档中复制数组的最佳方法。
这是我试图复制的文档的外观:
{
"CreatedAt": "2013-03-26T15:58:05.5130458",
"IsMostRecent": true,
"ClientId": "clients/417",
"StatusType": "Live",
"Start": "2013-03-31T00:00:00.0000000",
"End": null,
"EndCharge": null,
"AssessmentDate": null,
"Correspondence": null,
"Service": {
"$type": "xxxx.xxxx.xxxx.xxxx.Personalisation, xxxx.Care.Core",
"IsDirectBilling": false,
"Visits": [
{
"DayOfWeek": "Monday",
"Start": "09:00:00",
"End": "10:15:00",
"AdditionalResources": true,
"SocialWork": {
"Duration": 30,
"BillableTo": "SocialWork",
"VisitTasks": [
"GoingToBed",
"DressingAssistance",
"WashingBathingAssistance",
"AssistWithPersonalGrooming"
]
},
"PrivateWork": {
"Duration": 45,
"BillableTo": "Private",
"VisitTasks": [
"SupportWithRehab",
"FoodPreperation",
"ShoppingErrandRunning",
"NonSpecialisedLaundry",
"CheckVisit",
"MealsAtHomeService",
"Escorting"
]
}
},
{
"DayOfWeek": "Wednesday",
"Start": "09:00:00",
"End": "10:15:00",
"AdditionalResources": true,
"SocialWork": {
"Duration": 30,
"BillableTo": "SocialWork",
"VisitTasks": [
"GoingToBed",
"DressingAssistance",
"WashingBathingAssistance",
"AssistWithPersonalGrooming"
]
},
"PrivateWork": {
"Duration": 45,
"BillableTo": "Private",
"VisitTasks": [
"SupportWithRehab",
"FoodPreperation",
"ShoppingErrandRunning",
"NonSpecialisedLaundry",
"CheckVisit",
"MealsAtHomeService",
"Escorting"
]
}
},
{
"DayOfWeek": "Friday",
"Start": "09:00:00",
"End": "10:15:00",
"AdditionalResources": true,
"SocialWork": {
"Duration": 30,
"BillableTo": "SocialWork",
"VisitTasks": [
"GoingToBed",
"DressingAssistance",
"WashingBathingAssistance",
"AssistWithPersonalGrooming"
]
},
"PrivateWork": {
"Duration": 45,
"BillableTo": "Private",
"VisitTasks": [
"SupportWithRehab",
"FoodPreperation",
"ShoppingErrandRunning",
"NonSpecialisedLaundry",
"CheckVisit",
"MealsAtHomeService",
"Escorting"
]
}
}
],
"_visits": [
{
"DayOfWeek": "Monday",
"Start": "09:00:00",
"End": "10:15:00",
"AdditionalResources": true,
"SocialWork": {
"Duration": 30,
"BillableTo": "SocialWork",
"VisitTasks": [
"GoingToBed",
"DressingAssistance",
"WashingBathingAssistance",
"AssistWithPersonalGrooming"
]
},
"PrivateWork": {
"Duration": 45,
"BillableTo": "Private",
"VisitTasks": [
"SupportWithRehab",
"FoodPreperation",
"ShoppingErrandRunning",
"NonSpecialisedLaundry",
"CheckVisit",
"MealsAtHomeService",
"Escorting"
]
}
},
}
}
到目前为止,这是我的复制脚本,目前正在复制一些列,但不是全部:
replicateToServiceStatusDetails({
ClientId: this.ClientId,
StatusType: this.StatusType,
Start: this.Start,
End: this.End,
EndChargeDate: this.EndChargeDate,
AssessmentDate: this.AssessmentDate
});
for (var i=0; i<this.Service.length; i++)
{
replicateToService(
{
IsDirectBilling: this.IsDirectBilling
});
}
for (var i=0; i<this.Service.Visits.length; i++)
{
replicateToVisits(
{
DayOfWeek: this.Service.Visits.DayOfWeek,
Start: this.Service.Visits.Start,
End: this.Service.Visits.End,
AdditionalResources: this.Service.Visits.AdditionalResources
});
}
for (var i=0; i<this.Service.Visits.SocialWork.length; i++)
{
replicateToSocialWork(
{
Duration: this.Service.Visits.SocialWork.Duration,
BillableTo: this.Service.Visits.SocialWork.BillableTo
});
}
for (var i=0; i<this.Service.Visits.PrivateWork.length; i++)
{
replicateToPrivateWork(
{
Duration: this.Service.Visits.PrivateWork.Duration,
BillableTo: this.Service.Visits.PrivateWork.BillableTo
});
}
寻找有关如何复制所有列的一些想法。