It’s really easy to work with MongoDB but sometimes we don’t have the firewall permissions to connect to our cloud hosted MongoDB instance. One quick way to solve this is using the Codio cloud IDE with pre-configured stacks & coding environments. With the Codio terminal you can quickly and easily get a connection to the MongoDB instance and use MongoDB shell and within 5 minutes have your MongoDB shell working.

Follow these steps:
1. Create a free account on Codio, then add a Starter Pack and an HTML5 Boilerplate project.

2. Go to Tools, Install Software and then select ‘mongodb’.

3. Go to Tools, Terminal, then type the below commands. This will display all the documents in the collection.

mongo yourDB.mongolab.com:59511/YourDbName -u YourUser -p YourPw
myCollection = db.getCollection('MyDataCollection')
myCollection.count()
myCollection.find().pretty()

MongoDB_Logo
Screenshot 2015-01-06 09.51.48

Summary
Codio is a powerful platform and using it is easy, especially with the Terminal and MongoDB shell. Big thanks to Arthur Eyckerman for introducing me to the world of Codio.

Author: Robert Curlette

Robert organizes the Tridion Developer Summit, likes teaching workshops on SDL Tridion, and helps customers implement solutions with SDL Tridion, DD4T, and Alchemy GUI Extensions. If you would like help, please contact me.