Running MongoDB from Sublime Text 2

Posted by Mark Drew on code on November 8, 2013

Tagged under

For last night's presentation at the CFUG about MongoDB I was running the demos right from Sublime Text 2. This was mainly to be able to increase the font but I was asked how I did it. (I generally use either the mongo shell or RoboMongo which is awesome!)

Here you can see how it was running: 

The way I pulled this off was to create my own Build System called MongoDB:

Now that you have a blank Build system, all you need to do is enter the following:

Of course, replace the path to mongoDB with whatever the path to your installation of mongoDB is! And finally all you have to do is hit the cmd+B buttion and it will then send the path to the current file to mongo. 

I got this working for Sublime Text 2 but in Sublime Text 3 it didn't work as expect the code is not exactly the same. You have to change the build script to the code below:

I can send commands to MongoDB too but it doesn't display anything in the Results pane which is a shame. So if you get it working in Sublime Text 3 let me know! 


comments powered by Disqus