MongoDB Upgrade to 3.0

11 Sep
Guides > Labs > MongoDB Upgrade to 3.0

What is Happening?

All free Sandbox databases running MongoDB 2.6 will be updated to MongoDB 3.0 on September 30, 2015. In order to ensure your Nightscout website continues to work, you may need to take action if any of the following are true:

  • You use the Nightscout uploader app.
  • You use the xDrip uploader app.
  • You use a Nightscout site (viewing in a browser or using a Nightscout Pebble watchface).

Depending on which of the above conditions is true for you, you may need to do one or more of the following:

Please read each section below to determine the changes you need to make. Even if you have already updated one thing (like your site), you may still need to take other steps (like switching to REST API).

You can make these changes at any time it is convenient before September 30, 2015. If you do not make the required changes before September 30, your site may not work after that point. We recommend that you do not wait.

Switch to REST API

[NOTE: If you use iOS/Share as your upload method, you do not need to do these steps.]

Users of both xDrip and the Nightscout uploader app need to switch to REST API as the upload method to ensure Nightscout will continue working after 9/30/15. REST API offers several advantages, including the use of HTTPS, which improves privacy by encrypting the data sent from your uploader phone to your website. REST API also works better on WiFi networks where firewalls may block access to MongoDB upload ports (e.g., schools, hotels, and public hotspots).

NOTE: After you switch to REST API, you need to turn OFF your MongoDB upload in your uploader in order to see if your change works.

The basic steps to switch to REST API are:

  1. Set an API_SECRET value in your site (Azure or Heroku) settings, if you do not already have one. Your API_SECRET must be 12 characters minimum. (Care Portal users already have an API_SECRET set.) You will need to go to Configure/Connection Strings to add this variable. After adding the API_SECRET, be sure you save the altered settings.restapi-secret2

    Note: In Azure, it is recommended that the API_SECRET be placed in the Connection Strings section because it is a passphrase. The “type” should be set to “Custom,” as shown above. (If you already have an API_SECRET set, and it is in the App Settings, it will still work, but please note that you can only have the API_SECRET set in one place.)

  2. Configure the BASE URL for REST API on your uploader.
    • RECOMMENDED: You can use the auto configure tool to properly format your REST API string for your uploader.
    • OR, you can manually set up REST API in xDrip settings or the Nightscout uploader preferences.If you are using a current version (beta) of xdrip or the Dreamsicle version of the Nightscout uploader, the BASE URL takes the following format, where you replace the sample text shown in red below with your own API_SECRET and site name:
      https://YOURAPISECRET@YOURSITENAME.azurewebsites.net/api/v1/

      or

      https://YOURAPISECRET@YOURSITENAME.herokuapp.com/api/v1/

      (Older versions and the Medtronic uploader use a different syntax. We recommend you update your uploader application (download a current one), but if you are using Cookie Monster as an uploader or the Medtronic uploader, you will need this format: YOURAPISECRET@https://YOURSITENAME.azurewebsites.net/api/v1/

      To configure your uploader manually, use these steps:

      • In the Nightscout uploader app, turn the API UPLOAD (REST) option “ON” (in preferences), and tap the BASE URL section to open a popup screen in which you can enter the BASE URL (using the syntax shown above for your Azure or Heroku site).rest-ns-dreamsicle-on

        rest-ns-dreamsicle-enterstring

      • In xDrip, click the API UPLOAD (REST) option on the settings screen:xdrip-restapi-300

        Turn the option “ON” and fill in the BASE URL (using the syntax shown above for your Azure or Heroku site).

        xdrip-restapi-string-300

  3. Turn OFF your MongoDB upload in your uploader. (Do NOT delete your mongo strings in Azure. Those must stay as they were. REST API upload simply gets information to your database in a different way. You still have a mongo database. You are just not using mongodb as an upload method.)
  4. Wait a few minutes and make sure that your site is updating normally (e.g., ensure your site gets new data with MongoDB off).

For additional directions to configure REST API, including how to set the API_SECRET for your site, see REST API – How to upgrade to the new upload technique.

Note: if you experience a problem with the uploader battery percentage reading on your site after switching to rest, you will need to go into the mongodb, open the devicestatus collection, and delete the records. This one-time action should resolve the battery percentage problem. See Fixing uploader battery % data

If you are having trouble with your REST API configuration, see these troubleshooting tips.

Update Your Nightscout Site

Nightscout sites deployed after Jan 21, 2015 should continue to work after the Mongo 3 change happens. This means if you are running Funnel Cake, Enchilada, or Dreamsicle 0.6.1 or newer, your site should have an appropriate driver to support Mongo 3. Even if you decide not to update to Funnel Cake, this does NOT mean you do not need to take other steps to be prepared for Mongo 3. PLEASE SEE THE REST API SECTION ABOVE.

The Funnel Cake code contains a newer mongodb driver, so updating to Funnel Cake is a recommended step. Step-by-step directions to update your site can be found here. After updating, be sure and explore new Funnel Cake features and options.

Users of Nightscout Uploader App

The current version of the Nightscout uploader app will not work with Mongo 3 if you upload using the mongodb method. Updating to REST API (see above) is required.

Users of xDrip

UPDATED! xDrip will not currently work with Mongo 3. Updating to REST API (see above) is required.

Users of Medtronic Nightscout Uploader

UPDATED NOTE: The uploader app used for Medtronic Nightscout requires the older syntax for REST API. Please use this format when configuring the BASE URL for MEDTRONIC NIGHTSCOUT:

YOURAPISECRET@https://YOURSITENAME.azurewebsites.net/api/v1/

Nightscout Bridge Users

If you use Nightscout to view your iOS/Share data, you do need to read through the information below and ensure your site is up to date. You do not need to alter your upload method (e.g., REST API does not pertain to you). If you either Nightwidget or Nightwatch, please read the information below regarding those.

Nightwidget

Unless you installed Nightwidget after October 2, 2015, the version of Nightwidget you have will not work with Mongo 3. An updated version is now available. You will need to download the update and then follow directions to configure it to work with Mongo 3.

Nightwatch

Nightwatch will work with Mongo 3. Nightwatch can be used as a viewer, a widget, or with an AndroidWear watch.