我正在使用 mongolite 包从 MongoDB 连接和检索数据。如何在 mongolite 查找查询中传递值
##connecting mongodb
library(mongolite)
mongo<-mongolite::mongo(collection = "Sample", db = "Test", url =
"mongodb://User:123@Wyyuyu:13333/ty2_U",verbose = TRUE)
## getting all data from collection data from collection below query is working fine.
values <- mongo$find()
## But I want to filter specific value by passing value.
for(i in c("process","check","queue"))
{
values <- mongo$find('{"field" : i}',)
}
如果我尝试了上面的代码,我会遇到以下问题。请帮我解决
Error: Invalid JSON object: {"field" : i}