tc / RMongo

R client to interface with MongoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't insert R variable through dbInsertDocument()

rootkea opened this issue · comments

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

Closing this one as found same solved issue #26