Can I use backbone directly with MongoDB? *Without node.js, socket.io Can I use backbone directly with MongoDB? *Without node.js, socket.io mongodb mongodb

Can I use backbone directly with MongoDB? *Without node.js, socket.io


Mongodb does provide a http interface, which you can have your client side javascript app talk directly to.

However it is limited in what it can do.

There are multiple technologies you can use that will provide a more full featured http interface to mongodb

This link gives you all the information you need about interacting with mongo via HTTP and also overviews some 3rd party technologies to enhance its capability.

MongoDB - Http Interface

Hope it helps.


From a security perspective this is a Very Bad Idea. By doing this, you'd be opening up your database to the world, which is just asking for trouble. Anyone who examines your client-side code closely enough would be able to figure out how to access your mongodb and use it to store whatever they want at no cost to them and at full cost to you. Furthermore, if you're not careful, they would even be able to read other users' data or shut down or make changes to the server, including changing authentication credentials.

Unless you absolutely trust your users, you need to have some middleware (such as node.js) that sits on a server (not client-side) whose job it is to say "yes you can do that, no you can't do that."


Raadad mentions the HTTP interface, however it is (as the page he linked states) provided for convenience only. It is not a full featured REST interface, and it is not recommended for production. If you are looking for such an interface, then you should take a look at sleepy mongoose and similar:

http://www.snailinaturtleneck.com/blog/2010/02/22/sleepy-mongoose-a-mongodb-rest-interface/

Basically, what I am saying is, if you run into issues with the HTTP interface, the first piece of advice everyone is going to give you is "don't use the HTTP interface".

If you want to keep everything native and in node.js, then the officially supported native node.js driver is the way to go:

https://github.com/mongodb/node-mongodb-native