Connecting to your MongoDB

vps

#1

I just got an email from a very happy bot that told me that MongoDB was successfully set up for my VPS.

And the email contained instructions for how to connect to mongodb from the shell.

And all was well.

Except that the email contained no information about how to actually connect once you have created a db.

How do you connect to a mongo on Dreamhost?

Do you use ‘mongodb://admin:generatedpassword@psxxxxxx.dreamhostps.com/yourdb’ ?

Sadly, the email did not contain that information, and the Dreamhost wiki page for MongoDB is equally empty :slight_smile:

Yes, I did contact support, but despite my question, I was told to read the email and rtfm at MongoDB docs.
Which I already have, obviously.

Thanks in advance. :slight_smile:

PS:
When trying to connect using the above connectionstring, I get an ‘auth’ error.

Tried adding a user, but mongo threw an error telling me that it expected version 3 of some schema and only got version 1.


#2

I got a reply from the support staff - and it linked me to this post on StackOverflow:

It actually worked :slight_smile:

What I did was run this on my db in the admin shell:

db.getSiblingDB(“admin”).runCommand({authSchemaUpgrade: 1 });

After running that, I was able to successfully create a new user, and I connected to the db using this connection string:

mongodb://user:password@psxxxxxx.dreamhostps.com/dbname

The user and password are the credentials of the newly added db user.