我们正在尝试在配置单元中使用mongodb数据,文档具有子文档数组。如何将复杂数据加载到配置单元中?
这是示例json:
{
"_id" : ObjectId("582c8cb9913e2f21e062aaa6"),
"acct" : NumberLong(12345),
"history" : [
{
"startDate" : ISODate("2016-09-01T16:00:00.000Z"),
"endDate" : ISODate("2016-09-30T16:00:00.000Z"),
"averageDailyBal" : "2653.85"
},
{
"startDate" : ISODate("2016-10-01T16:00:00.000Z"),
"endDate" : ISODate("2016-10-31T16:00:00.000Z"),
"averageDailyBal" : "1840.15"
},
{
"startDate" : ISODate("2016-11-01T16:00:00.000Z"),
"endDate" : ISODate("2016-11-30T17:00:00.000Z"),
"averageDailyBal" : "2796.14"
}
]
}
谢谢...
最佳答案
如您所知,MongoDB中的数据以JSON格式存储,因此您可以使用任何Json Serde解析其中的数据。
Refer this
关于mongodb - 如何将子文档数据数组从mongodb加载到Hive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41619766/