The official NightScout site has been updated with good documentation on Connection String issues, you can now use that page as a companion to this one. http://nightscout.github.io/troubleshoot/connection_string/
This is still the better page if you like printed step by step numbered directions.
If you messed up your Atlas db string for NightScout, here is how you make a new one.
Note, if you migrated, or set up NightScout and had it working on Atlas, this is probably not the fix you are looking for. This is only if you messed up the connection string and don’t have the correct username/password combo to put it back together.
- Sign into your Atlas account.
- Click the drop-down arrow next to your account name in the top right.
- Scroll down to “Organizations” from the drop-down menu.
- You should only have one organization, if you have more than one, pick the one that goes to your Nightscout site. Click your Organization Name.
- You should only have one project, click the Project Name.
- You should be at the Clusters screen, there should be a blue oval with the word “SANDBOX” on the screen. We will come back here, for now, go to “Database Access” below Security on the menu on the left.
- You need to create a new User Name by clicking the big green button “Add New Database User“. You should call your new User Name “nsdbuser”. If you already have a “nsdbuser”, click “DELETE” on the far right and follow the prompts to remove the user.
Authentication Method Password.
User Name (first box) nsdbuser (all lower case).
Password (second box) enter an EXACTLY a 12 character password containing only numbers and lower case letters such as “pizza4uandme“.
- Change the Database User Privileges to “Atlas Admin“.
- Make no other changes to this screen, click the green “Add User” button.
- You should be back at the Database Access screen and you should see your new user.
- Click on “Clusters” tab on the far left under DATA STORAGE.
- Click the grey “COLLECTIONS” box.
- You should see the name of your database, it will be something like “nightscout.activity” or if you migrated it could be some gibberish like “heroku_bqxhd9zz.activity”. Whatever it is, write it down or copy it to a scratchpad the part BEFORE THE “.activity” it is your database name, which you will enter into the connection string in a bit.
- Click on “Clusters” tab again.
- Click the grey “CONNECT” button.
- Click the middle “Connect your application” box
- Click “Copy” to get a copy of the string.
- Click “Close“.
- Open some kind of a scratch pad such as a Google Doc, Notepad, Wordpad, Textedit.
- Paste into the scratchpad (left click, paste).
- You should end up with a string that looks like this:
- Check that the username is correct, if not, change it.
- Replace the password with your 12 character password
- Replace the dbname with your database name
Your string should look like this:
This string will be used as your MONGO_CONNECTION variable in Heroku.
If you are making a new Nightscout site, the build procedure might make you put this string into MONGO_URI or something similar. After the build is complete, go back into ConfigVars and delete this entry and instead add the MONGO_CONNECTION variable and put the string in there.
Support for NightScout (If you are still stuck) is in the FaceBook group CGM in the Cloud
Comments, corrections, complaints about this document can be sent via the feedback link below, it is only for comments about the document, no support will be given via the feedback page.