[英]How to retrieve sub documents in a Array from mongoDB using python script
[英]How to load the array of sub documents data from mongodb to hive
我們正在嘗試在配置單元中使用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解析其中的數據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.