librelist archives

« back to archive

extension: Flask + MongoDB frontend

extension: Flask + MongoDB frontend

Jay Goel
2013-11-11 @ 06:03

I have written (yet another?) MongoDB frontend as a Flask extension.

In contrast to other extensions - all of which are fantastic - I had the
following goals:

1. It does not use any sort of ORM or models. It is intended to let you
read and write pure JSON, which is often useful when working with mongo.

2. It supports connections to multiple databases. If you're managing many
applications, you could conceivably manage all of their databases via this

3. It is a thin wrapper around the pymongo library. That is, it does as
little error checking as possible, preferring to pass data to pymongo and
allow *it* to do its own validation. All pymongo errors are passed back to
the user unadulterated. The goal is to let things work as consistently with
the raw pymongo driver as possible.

This code is far from perfect. (Specifically, my next step will be to
refactor the main blueprint into its own module. And then add other
rudimentary functionality, like "deleting documents.")

I am very amenable to pull requests, bug reports, or feedback. Otherwise, I
hope everyone enjoys!


Jay Goel