windows azure mongodb tutorial not working
Problem
i followed the following tutorial: https://www.windowsazure.com/en-us/develop/nodejs/tutorials/website-with-Mongodb-(mac)/
and executed app.js just as the tutorial said but i got:
No data received Unable to load the webpage because the server sent no data.
I was wondering what does the tutorial mean by:
You must replace the connection string above with the connection string for the MongoDB server you created earlier. For example, mongodb://mymongodb.cloudapp.net/tasks.
Thanks.
Related Articles
Solution
The error you received means "there is no connectivity between your node.js application and MongoDB server". This tutorial has a very important step to install MongoDB as below:
Create a virtual machine and install MongoDB
- This tutorial assumes you have created a virtual machine in Windows Azure. After creating the virtual machine you need to install MongoDB on the virtual machine:
- To create a Linux virtual machine and install MongoDB, see Installing MongoDB on a Linux Virtual machine.
So if you have completed above steps you must have created your MongoDB installed Virtual Machine DNS name as "Your_MongoDB_VM_name.cloudapp.net", if not please finish this step.
So if you have installed MongoDB on Linux Virtual Machine and if your DNS name is "Your_MongoDB_VM_name.cloudapp.net then in App.js you will change the following line as beow:
var taskList = new TaskList('mongodb://Your_MongoDB_VM_name.cloudapp.net/tasks');
The above change will let your Node.js application to connect with MongoDB server running on Linux machine and this change must needed in your node.js application to work.
Discussion
View additional discussion.