com presentations: Added missing content: slides/mongodb/scalar-query-postgresql-jsonb.xml
| From: | Derick Rethans | Date: | Wed, 20 Feb 2019 12:19:16 +0000 |
| Subject: | com presentations: Added missing content: slides/mongodb/scalar-query-postgresql-jsonb.xml | ||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-2334@lists.php.net to get a copy of this message | ||
Commit: b7ef2c4796c6dd76ee94592c96d1d64ca1ee892e
Author: Derick Rethans <github@derickrethans.nl> Wed, 20 Feb 2019 12:19:16 +0000
Parents: fe6d479b9ae23e45fc8073b87a11a20f18533be8
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=b7ef2c4796c6dd76ee94592c96d1d64ca1ee892e
Log:
Added missing content
Changed paths:
M slides/mongodb/scalar-query-postgresql-jsonb.xml
Diff:
diff --git a/slides/mongodb/scalar-query-postgresql-jsonb.xml
b/slides/mongodb/scalar-query-postgresql-jsonb.xml
index 007bc65..2343b39 100644
--- a/slides/mongodb/scalar-query-postgresql-jsonb.xml
+++ b/slides/mongodb/scalar-query-postgresql-jsonb.xml
@@ -1,4 +1,33 @@
<slide>
<title>PostgreSQL: Query JSONB</title>
+<example inline="2">
+INSERT INTO users VALUES('{
+ "_id" : "derick@localhost",
+ "email" : "derick@localhost",
+ "words" : [ "derick", "rethans", "london",
"uk" ]
+}');
+</example>
+
+You might add a B-tree index on hdoc->>'email';
+
+<blurb>Find %_id% for %email% address (B-tree-index):</blurb>
+<example inline="2">
+SELECT hdoc->>'_id' FROM users WHERE *hdoc->>'email'* =
'derick@localhost';
+</example>
+
+<blurb>Find %users% without a %country% value set:</blurb>
+<example inline="2">
+SELECT hdoc->>'_id' FROM users WHERE hdoc->>'country' IS NOT NULL;
+</example>
+
+<blurb>Find users where %words% includes %london% (GIN index):</blurb>
+<example inline="2">
+SELECT \* FROM users WHERE *hdoc* @> '{"words": ["london"]}';
+</example>
+
+<blurb>Update or add field:</blurb>
+<example inline="2">
+UPDATE users SET hdoc = hdoc || '{"country": "Europe"}';
+</example>
</slide>