tc / RMongo

R client to interface with MongoDB
102 stars 34 forks source link

Can't insert R variable through dbInsertDocument() #48

Closed rootkea closed 7 years ago

rootkea commented 7 years ago

script.R

rootkea <- mongoDbConnect('rootkea')
var <- "foo@bar.com"
dbInsertDocument(rootkea, "result", '{"email": var}')

Output:

$ Rscript script.R 
Loading required package: rJava
Loading required package: methods
Error in .jcall(rmongo.object@javaMongo, "S", "dbInsertDocument", collection,  : 
   com.mongodb.util.JSONParseException: 
{"email": var}
          ^
Calls: dbInsertDocument -> dbInsertDocument -> .jcall -> .jcheck -> .Call
Execution halted
rootkea commented 7 years ago

Closing this one as found same solved issue #26