Connecting to Mongo

I have been using Exploratory with simple CSV files and its an amazing tool - however I have been trying to connect it up to my mongo instance (tried both amazon hosted and local hosted details) but I simply get a ‘authentication error’ or simply ‘could not connect’. I’ve triple checked the credentials and details but still no luck.

Does anyone know of anything you need to do to get it working? Or is anyone else having this issue?

Hi, mitchelllisle,

Can we get on Google Hangout or Skype so that we can take a look at it together? If so please send me an email at kan@exploratory.io

Just to say I’m also having problems connecting to MongoDB and MySQL databases on our network using credentials that work in MongoChef and MySQL workbench respectively. I’ve added myself as a watcher.

Hi Henard, Can you also send me an email to setup a call? kan@exploratory.io

By the way, is your database setup with SSL?

Hi Kan, Thanks for getting back to me so quickly… I’ve asked a colleague here to look at my issue and he’s solved the MySQL connection issue and has an likely explanation for why I can’t connect to our MongoDB:

MySQL - I had the wrong port number - Now fixed
MongoDB - My colleague suspects it is because we authenticate our connection against a different database (our ‘admin’ one) to the one we want to query (the ‘data’ one). We were successful in connecting to our admin DB but we then can’t query the DB with the data! (apparently centralised authentication is MongoDB recommended approach.)

Oh, and it’s not setup with SSL

Thanks,
Henry

As to the issue Mitchell was facing, it was because Exploratory was requiring username/password input values even when they were not needed. We have fixed it, verified the fix with Mitchell. We will release a patched version as v1.10.1 shortly, please stay tuned!

1 Like

Hi Kan - Do you know if Exploratory connect to a MongoDB database where authentication is done in one DB and querying in another DB?
Henry

Hi Henry,

I’m not familiar with the configuration, but would you mind trying to see if this works in R or RStudio with mongolite package? This is what we are using internally to connect to MongoDB. If there is a way to make it work in R then we can update the UI to support it.

https://cran.r-project.org/package=mongolite

Thanks Kan - A very brief look at mongolite suggests it does NOT handle authentication via a separate admin database at present. Nervermind. I’ll pursue trying Exploratory on some standard authenticated mongo dataset for now.
Many thanks,
Henry

Hi Henry, sorry for my ignorance, but would you share any doc for setting up such separate authentication for MongoDB? If we can set that up internally then we can try to figure out how to support it.

You’ll see I just edited my previous post to correct it to say mongolite appears NOT to handle authentication via a separate admin database. Nonetheless I’ll see if I can lay my hands on something that describes the authentication method for our MongoDB set up. Thanks

Ok, cool. Thanks Henry!

Hi Kan,

We have several MongoDB databases here and connections are authenticated using an separate authentication database as described on this page of the MongoDB website:

https://docs.mongodb.com/manual/core/security-users/#user-authentication-database

I think that the difficulties I’m having connecting to my MongoDB databases with Exploratory is a result of a limitation in R’s mongolite library which appears to currently not support this type of authentication. However, I’d be interested to hear you assessment if you get a chance. (If I am correct, I appreciate that any solution to my issue may have to wait until R’s mongolite library is extended to support this type of authentication, which if fine.)

Thanks in advance for you advice.

Henry

Hi Henry,

Thanks for the info.

Looks like ‘Connection String URI’ supports ‘authentication db’, which means mongolite can support it, I’m hoping. Can you try the below in R (Standalone or RStudio)? Basically you need to set ‘authSource’ argument for your authentication db.

library(mongolite)
url_txt <- "mongodb://<username>:<password>@<host>:<port>/<db>"?authSource=<your_auth_db>) 
con <- mongo(<collection_name>, url = url_txt)
data <- con$find(query = "{}")
flatten(data)

If you are not sure we can get on Hangout as well, let me know.

Hi Kan,
I have been able to successfully connect and query our mongodb database in R (standalone) using mongolite and your skeleton code with the appropriate URI connection string and specifying the database and collection in $find(db=“xxxxx”, collection=“xxxxx”, limit=10) function. I hope this helps with any changes that might be needed to Exploratory to support this (if changes are indeed required). The option to paste in the URI string might be a good solution.
Many thanks,
Henry

Just as the heads up, we’re releasing v2.2 tonight, and it will include this authentication db support!

Hi Henry,

We have just released v2.2 with the authentication db support, please download the latest and try it out, and let us know if it works for you!

Hi Kan,
Thank you very much for adding authentication support - I’ve just tried it and it works - Great!
I have a couple of questions regarding how I can query my Mongo Db for the N most recent records - I’ll ask that in a separate issue/ question.
Thanks once again.
Henry

Thanks for verifying it! Glad to hear it worked for you!