INSERT INTO users VALUES('{
"_id" : "derick@localhost",
"email" : "derick@localhost",
"words" : [ "derick", "rethans", "london", "uk" ]
}');
Find _id for email address (B-tree-index):
SELECT hdoc->>'_id' FROM users WHERE *hdoc->>'email'* = 'derick@localhost';
Find users without a country value set:
SELECT hdoc->>'_id' FROM users WHERE hdoc->>'country' IS NOT NULL;
Find users where words includes london (GIN index):
SELECT \* FROM users WHERE *hdoc* @> '{"words": ["london"]}';
Update or add field:
UPDATE users SET hdoc = hdoc || '{"country": "Europe"}';