mongodb in azure


Let’s use the add on service to our Microsoft Azure cloud tenant, augmenting the fabric with mongodb:

image

http://msopentech.com/blog/2014/04/22/mongolab-offers-new-options-mongodb-developers-azure/

so when we apply the following:

image

image

we get a working mongodb instance

image

mongo ds052837.mongolab.com:52837/mongodb -u pwilliams –p …

https://mongolab.com/databases/mongodb

 

now we work a tutorial from node.js to our mongodb db/collection (before even attempting the NAR node.js integration with this instance):

our connection string, from azure,  is mongodb://mongodb:yilxWKhgqv17AHdd3P4ur3PkYJxwkwVpdjCE6.CctrA-@ds052837.mongolab.com:52837/mongodb

we learn to install express (the scaffolding tool for the express web app framework)

image

http://expressjs.com/guide.html#executable

 

and upon using the tool, we get output similar to that suggested in the tutorial:

image

Per instructions we ‘npm install’

image

And install the “mongoose” db driver

image

Using visual studio and a nominal project, we then modify the application, per instructions (largely, with exceptions in app.js).

image

we assign the environment connection string, per instructions:

image

Clearly, we have a basic website up and running:

image

now, the site doesn’t work (but then we didn’t feel the instructionsquite matched what we were seeing from the expected express scaffolding).

 

so we start again, this time using the microsoft express project type (to which we then add the controllers, routers, and app hookups, as per the instructions); again.

 

Now we have success, once we publish to the same website as used earlier, replacing code:

image

With that done, we see clearly that the webapp’s post b ack page works, since we can see records in the db – using its management console:

 

image

Now we have see one express project, talking to our mongodb instance via the mongoose driver, we can go have a more careful look at the NAR code. Perhaps we can see how to make it talk to our mongodb instance, now, and then host it too in the azure cloud.

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in nodejs. Bookmark the permalink.