help with R and mongo_db connectionhello community
i'm trying to connect on MongoDb through R interface by JSL script
i need to pass this strings
Names Default To Here( 1 );
RConnection = R Connect();
rc = RConnection << Submit("
library(mongolite)
m <- mongo(collection = "Param", db = "DbParam", url = "mongodb://ailyxxxx01a:27017/DbParam")
d <- m$find('{"\"FLDLOT" : "\""xxxxxx.000\""}')
;
but i got sintax errors
how i can pass red strings correcty into code?
thanks in advance
Gianpaolo
Re: help with R and mongo_db connectionI solved it by myself:
the issue was related to sintax error introduced by " into R code
need to use escape characters because to substitute " with \!"
R Init( );
R Submit( "
library(mongolite)
m <- mongo(collection = \!"ColParamLot\!", db = \!"DbaLfoundryParam\!", url = \!"mongodb://ailymsmdb01a:27017/DbaLfoundryParam\!")
d <- m$find('{\!"FLDLOT\!" : \!"8588679.009\!"}')
");
R Term();
Re: help with R and mongo_db connectionthe code work well.... i did it with R and i obtain the data
library(mongolite)
m <- mongo(collection = "Param", db = "DbParam", url = "mongodb://ailyxxxx01a:27017/DbParam")
d <- m$find('{"\"FLDLOT" : "\""xxxxxx.000\""}')
so.. is the JSL script that has sintax error.... i suppose becasue this " " characters
Re: help with R and mongo_db connection@gianpaolo,
Were you able to connect to mongodb using just R outside JMP ?
Additionally, look at this. I don't have mongodb so - cannot replicate the error .
https://datascienceplus.com/using-mongodb-with-r/
Re: help with R and mongo_db connectionin red below the error
Unexpected "ColParamLot". Perhaps there is a missing "," or ")".
Trying to parse arguments of function "Submit".
Line 12 Column 27: m <- mongo(collection = \"►"ColParamLot""\, db = \"
Re: help with R and mongo_db connection@gianpaolo,
Were you able to successfully connect to MongoDB using R outside JMP ? I would suggest you to share your syntax errors as well to provide the community a better insight into what your problems might be