Does this mean I can do Mongo-style queries, retrieving a set of documents which match particular key: value criteria, using PostgreSQL?
Does this mean I can do Mongo-style queries, retrieving a set of documents which match particular key: value criteria, using PostgreSQL?
http://clarkdave.net/2013/06/what-can-you-do-with-postgresql...
The only thing to note about current JSON support in PostgreSQL is that, as far as I know, there is no way to update parts of a JSON document - you have to rewrite the entire document each time. I've not found this to be a big headache YMMV.
That's what jsonb fixes.
On the reading side there are functions and operators that allow you to reach into stored JSON and extract the parts you want. What would be nice would be to be able to do something similar for updates - although this is clearly more complex than reading, so I can see why it has been done this way.
Edit: I guess the most general solution would be to directly support something like JSON Patch:
With json/jsonb, you have to provide the entire object graph each time you are updating it. You can't update one field in the graph. Which could be a pain if you have concurrent updates.
Hopefully we'll be able to update parts of the jsonb columns sometime.
[1] http://www.postgresql.org/docs/devel/static/storage-toast.ht...
http://www.postgresql.org/message-id/CACu89FSYikxdUj+J01BoAv...
[NB Not being snarky... genuinely curious about this!]
It provides a Mongo-like API directly on Postgres, using normal tables/columns. I've used it in some projects in the past on some projects and it's fairly staightforward, and makes it easy to port an app from Mongo->Postgres.