Closed ColinFay closed 4 years ago
The problem is that your query string is invalid JSON because json may only use double quotes to enquote a string, and you are using single quotes. Perhaps Compass is a bit more lenient, but in jsonlite you need to use proper json!
Can you try this:
con$find('{"name" : "colin"}')
Ah, indeed, that does work.
Thanks for the answer! Closing then.
Hello,
When I do things in Mongo, I'll first try to write my query in MongoDB Compass with the cli. So, in literal JSON.
When I get back to R, I can't pass this very same string to
mongo$find()
.Here's a reprex:
Created on 2019-10-03 by the reprex package (v0.3.0)
This works in CLI / compass:
As far as I see, it's due to the fact that
{jsonlite}
is unable to convert the string to JSON.I wonder if we could have something like
con$find("{'name' : 'colin'}", literal = TRUE)
to be able to do that?