1
如何將mongodb文檔列表轉換爲表格形式?如何將mongodb文檔列表轉換爲表格形式?
例子:
我BsonDocuments
[0] = { "_id" : ObjectId("546ce80d43f5c2b7d8a713bd"), "Address" : "61- A, Pocket- C, Ram Vihar Phase II, UP", "Pincode" : 110091, "Locality" : "Mayur Vihar Phase II", "City" : "Delhi", "Latitude" : 28.618156, "Longitude" : 76.3055877 }
[1] = { "_id" : ObjectId("546ce80d43f5c2b7d8a713bd"), "Address" : "61- A, Pocket- C, Phase II, Rahi", "Pincode" : 110091, "Locality" : "Mayur Vihar Phase II", "City" : "Delhi", "Latitude" : 28.618156, "Longitude" : 77.305877 }
[2] = { "_id" : ObjectId("546ce80d43f5c2b7d8a713bd"), "Address" : "6 B2C - C, Krish Marg II, Delhi", "Pincode" : 110092, "Locality" : "Mayur Vihar Phase II", "City" : "Delhi", "Latitude" : 28.618156, "Longitude" : 76.305877 }
我想轉換此列表表格像JSON像
Address:{'61- A, Pocket- C, Ram Vihar Phase II, UP',' '61- A, Pocket- C, Phase II, Rahi ','6 B2C - C, Krish Marg II, Delhi'} ,
Pincode:{'110091','110091','110092'},
...
同樣,對於各個領域的以下列表。
所以我的問題是: 是否有任何庫或我需要爲此編寫代碼?
感謝您的解決方案,但我有動態字段(字段名稱不能確定) – Deepak 2014-12-05 08:35:30
@ deepak.mhr看到我更新的答案,以顯示它如何在後處理期間完成。 – BatScream 2014-12-05 08:53:57
感謝您的更新解決方案,現在它的工作 – Deepak 2014-12-08 05:25:06