44

is there any possibility to access and retrieve data from MongoDB directly over JavaScript form browser without backend processing?

1
  • 1
    Another option would be to evaluate CouchDb. Here you have a full REST interface included Commented Apr 24, 2014 at 10:18

3 Answers 3

17

MongoDB natively does not have a fully usable REST interface. You will need either Python based Sleepy Mongoose or Node.js based MongoDB Rest

Please see http://www.mongodb.org/display/DOCS/Http+Interface for more information.

Mongo's inbuilt REST interface is very basic & read only.

Sign up to request clarification or add additional context in comments.

1 Comment

I was able to benchmark both Python based Sleepy Mongoose and Node.js based mongodb-rest. Node.js was an absolute winner with more then 600 req/sec throughput of my hello-world test.
3

If you happen to host your database on MongoLabs, they also expose a REST API. Watch out, it's not secure, as an API key is passed with each request, but your could use it to retrieve public data through Javascript:

https://support.mongolab.com/entries/20433053-Is-there-a-REST-API-for-MongoDB-

Once you have your mongolab db setup, you can access it thru REST request such as

$.getJSON("https://api.mongolab.com/api/1/databases/your-db/collections/your-collection/?apiKey=your-key", function(json) {
  //console.log( "JSON Data: " + json );
});

Comments

1

Not in the standard security context.

If you have a situation where you have elevated security rights (such as inside a custom browser extension) then it may become possible.

2 Comments

Yes, although I doubt one exists already, so you would have to write it.
You should explain How??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.