Ever since we started using NightScout more than two years ago I’ve always wanted to move to a more scalable option vs. the free sandbox offering from mlab as it was not making any sense not to use Azure and pay for paid version of mlab to avoid outages and performance issues. I heard from others in community where they opted in to host MongoDB databases themselves but ideally I wanted to use the subscription I have had access to host not only the web app, mobile app, logic app and … but also the backend data!
We had conversations to change the NightScout code to port everything to DocumentDB but that required a lot of effort till we heard that DocumentDB is now providing protocol support for MongoDB allowing us to host databases as is while benefiting from all scalability and redundancy capabilities the service provides!
After a conversation on twitter with Scott’s Hanselman and an internal email thread this past week I finally went though migration and here are the steps I followed to port all of our databases for NightScout and Loop from mlab to Azure!
- On Azure provisioned a DocumentDB account and ensured the NoSQL API was set to MongoDB
- Using MongoChef (Thank you Kirill and Scott for recommendation!) established a connection to both mlab and DocumentDB instances
- Provisioned an empty database in DocumentDB and magically with a copy and paste migrated all the collections over to DocumentDB
- After couple of minutes the operation was completed
- Next step was to change the connection string on NightScout Web App and just like that I switched to DocumentDB and said good bye to mLab!