How to connect MongoDB and insert the data into Db?

I am trying to connect with the MongoDB database and also insert the model output data frame. The Database has showing connect but not showing all collection. Given an error authentication.
Please share any suggestions. Also, please check my code to connecting database.

Blockquote

Install Library

library(devtools)
#install_github("Rmongo" , "tc")
library(rJava)
library(RMongo)
library(dplyr)

connect to database

mongo <- mongoDbConnect("xxxxxx",host = " xxxxxx", port = 27017) # db name

login

auth <- dbAuthenticate(mongo,"username","password")
auth

dbDisconnect(mongo)

#show the collections
dbShowCollections(mongo)
ListofTable <- dbShowCollections(mongo)

I would highly recommend using mongolite instead of Rmongo. I've never used Rmongo, but it has been archived, so it's safe to assume that it is no longer actively maintained. mongolite, on the other hand, has decent documentation - https://jeroen.github.io/mongolite/ and it is being updated on the regular.

When I had to use mongoDB, I don't remember mongolite giving me any major troubles.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.