R -How to pass value in mongolite Query

后端 未结 1 1637
时光说笑
时光说笑 2020-12-21 09:15

I\'m using mongolite package to connect and retrieve data from MongoDB.How to pass value in mongolite find query

##connecting mongodb

library(mongolite)

m         


        
相关标签:
1条回答
  • 2020-12-21 09:31

    Given your i is a variable, you need to create the string using something like paste0:

    values <- mongo$find(paste0('{"field" : ', i, '}') )
    

    but rather than a loop you could also use

    values <- mongo$find('{"field" : { "$in" : [ "process", "check", "queue" ] } }')
    
    0 讨论(0)
提交回复
热议问题