I have been searching online a lot to find how a variable value in R can be used to query a mongoDB collection using dbGetQuery. All examples of dbGetQuery contain static (constant) values only as in the below query.
dbGetQuery(mongo, "test_data", '{"foo": "bar"}')
In this query, 'bar' is a constant. How should I query if I need to use the value in a variable named 'bar'?
I have been searching online a lot to find how a variable value in R can be used to query a mongoDB collection using dbGetQuery. All examples of dbGetQuery contain static (constant) values only as in the below query.
dbGetQuery(mongo, "test_data", '{"foo": "bar"}')
In this query, 'bar' is a constant. How should I query if I need to use the value in a variable named 'bar'?