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
我得到要导入数据框的数据,但一个问题是可穿戴设备在库存集合数组中,我该如何解开可穿戴设备阵列。 –