What's the fastest way to create an API over a RESTful JSON interface for MongoDB?
Question: My technical experise is restricted to **Javascript** and **Python**.

How can I create an API for MongoDb that I may use with my client side
Javascript MVC framework?


Answer: If you are working with Django I'd recommend a stack consisting of an API
library plus a decent MongoDB schema layer (if necessary).

For instance:

  * Define your models with MongoEngine (<http://mongoengine.org/>)
  * Structure your API with Django-tastypie (<https://github.com/toastdriven/django-tastypie>)

That being said, I feel like MongoDB is not a perfect match for Django. Django
provides a lot of facilities like database syncing, which is set in place to
work around the very same issues NoSQL databases readily solve.

Some of the extra features that Django provides, like Admin UI, may not even
work out-of-the-box with NoSQL. I'm aware there is Django-nonrel which is
trying to bridge this gap (<https://github.com/django-nonrel>), but to be
honest, I'm not sure if its very stable or if its still being developed.

A little more approachable alternative might be to simply use Flask
(<http://flask.pocoo.org/>) with MongoEngine andFlask-RESTful
(<https://github.com/twilio/flask-restful>).

A proof-of-concept structure for such application:

    
    
    from flask import Flask
    from flask.ext import restful
    from mongoengine import connect, Document
    
    # MongoEngine model
    class User(Document):
        email = StringField(required=True)
    
    app = Flask(__name__)
    api = restful.Api(app)
    connect('yourdb') # connect to Mongo
    
    class MyAPI(restful.Resource):
        def get(self):
            return User.objects
    
    api.add_resource(MyAPI, '/')
    
    if __name__ == '__main__':
        app.run(debug=True)
    

etc.

