I'm trying to send query to my Mongo database depending on a variable producted in my R code. Unfortunately, Mongo query needs double quotes and the function "paste" in R doesn't support it. Here my variable is equal to "test01" but it will change at each iteration. I tried to build a great character chain named "req" thanks to some "paste" functions with returns:
req
> "'{\"id\":\"test01\"}'"
cat(req)
> '{"id":"test01"}'
Which seems to be as a query but when I try :
connection_db$count(jsonlite::toJSON(req))
It returns [0] whereas if if try :
connection_db$count('{"id":"test01"}')
It returns [1]. Can you help me please?