2
我試圖運行此查詢,並保持有此錯誤:錯誤:無效JSON對象
install.packages(「mongolite」)
library(mongolite)
m <- mongo(db = "ionmom")
m6 <- m$aggregate('[{"$unwind":"$cdr"}, {$lookup:{from: "inventory", localField: "_id", foreignField: "_id", as:"inventory"}},{$unwind: "$inventory"}, {"$project":{ "$project": {"cdr.duration": 1, "inventory.wearables.type":1, "inventory.wearables.status":1, "inventory.wearables.battery":1 }}}]')
# Error: Invalid JSON object: [{"$unwind":"$cdr"}, {$lookup:{from: "inventory", localField: "_id", foreignField: "_id", as:"inventory"}},{$unwind: "$inventory"}, {"$project":{ "$project": {"cdr.duration": 1, "inventory.wearables.type":1, "inventory.wearables.status":1, "inventory.wearables.battery":1 }}}]
非常感謝它的工作完善 –
@HueyDucVu - 不客氣。可以通過按下投票箭頭下的'嘀嗒'來「接受」答案:) – SymbolixAU
我得到要導入數據框的數據,但一個問題是可穿戴設備在庫存集合數組中,我該如何解開可穿戴設備陣列。 –