Functions for transforming PostgreSQL and PL/v8 into a totally awesome JSON document store