33
44# Document Store
55
6- ::::{grid}
6+ ::::: {grid}
77:padding: 0
8- :class-row: rubric-slim
98
10- :::{grid-item}
9+ ::::{grid-item}
10+ :class: rubric-slimmer
1111:columns: 9
1212
13+
14+ :::{rubric} Overview
15+ :::
1316Learn how to efficiently store JSON documents or other structured data, also
14- nested, using CrateDB's ` OBJECT ` and ` ARRAY ` container data types, and how to
17+ nested, using CrateDB's OBJECT and ARRAY container data types, and how to
1518query this data with ease.
1619
20+ CrateDB combines the advantages of typical SQL databases and strict
21+ schemas with the dynamic properties of NoSQL databases. While traditional
22+ object-relational databases allow you to store and process JSON data only
23+ opaquely, CrateDB handles objects as first-level citizens.
24+
25+ :::{rubric} About
26+ :::
27+ This feature allows users to access object properties in the same manner as
28+ columns in a table, including {ref}` full-text indexing <fulltext> ` and
29+ {ref}` aggregation <aggregation> ` capabilities.
30+
1731Even when using dynamic objects, i.e. when working without a strict object
1832schema, all attributes are indexed by default, and can be queried efficiently.
1933
2034Storing documents in CrateDB provides the same convenience like the
2135document-oriented storage layers of Lotus Notes / Domino, CouchDB,
22- MongoDB, or PostgreSQL's ` JSON(B) ` types.
36+ MongoDB, or PostgreSQL's JSON(B) types.
2337
24- With CrateDB, compatible to PostgreSQL, you can do all of that using plain SQL.
25- Other than integrating well with commodity systems using standard database
26- access interfaces like ODBC or JDBC, it provides a proprietary HTTP interface
27- on top.
38+ :::{rubric} Details
2839:::
2940
30- :::{grid-item}
41+ CrateDB uses Lucene as a storage layer, so it inherits its concepts
42+ about storage entities and units, in the same spirit as Elasticsearch.
43+
44+ :Document:
45+ In Lucene, the ** Document** is a fundamental entity, as it is the unit of
46+ search and index. An index consists of one or more Documents.
47+
48+ :Field:
49+ A Document consists of one or more Fields. A Field is simply a name-value pair.
50+
51+ While Elasticsearch uses a [ query DSL based on JSON] , in CrateDB, you can work
52+ with Lucene Documents using SQL.
53+ ::::
54+
55+
56+ ::::{grid-item}
57+ :class: rubric-slim
3158:columns: 3
3259
3360``` {rubric} Reference Manual
3461```
35- - [ ] ( inv: crate-reference# data-types-container)
36- - [ Querying] ( inv:crate-reference#sql_dql_container )
37- - [ ] ( inv: crate-reference# scalar-objects)
38- - [ ] ( inv: crate-reference# scalar-arrays)
39- - [ ] ( inv: crate-reference# sql_dql_array_comparisons)
62+ - {ref} ` crate-reference: data-types-container `
63+ - [ Querying containers ] ( inv:crate-reference#sql_dql_container )
64+ - {ref} ` crate-reference: scalar-objects `
65+ - {ref} ` crate-reference: scalar-arrays `
66+ - {ref} ` crate-reference: sql_dql_array_comparisons `
4067- [ Non-existing keys] ( inv:crate-reference#conf-session-error_on_unknown_object_key )
4168
4269``` {rubric} Related
4370```
44- - [ ] ( #fulltext )
45- - [ ] ( #geospatial )
46- - [ ] ( #machine-learning )
47- - [ ] ( #analytics )
71+ - {ref}` sql `
72+ - {ref}` connect `
73+ - {ref}` fulltext `
74+ - {ref}` query `
75+ - {ref}` geospatial `
76+ - {ref}` machine-learning `
77+ - {ref}` analytics `
4878
4979{tags-primary}` JSON `
5080{tags-primary}` Container `
@@ -53,25 +83,10 @@ on top.
5383{tags-primary}` Array `
5484{tags-primary}` Nested `
5585{tags-primary}` Indexed `
56- :::
57-
5886::::
5987
88+ :::::
6089
61- ## About
62-
63- CrateDB uses Lucene as a storage layer, so it inherits its concepts
64- about storage entities and units, in the same spirit as Elasticsearch.
65-
66- :Document:
67- In Lucene, the ** Document** is a fundamental entity, as it is the unit of
68- search and index. An index consists of one or more Documents.
69-
70- :Field:
71- A Document consists of one or more Fields. A Field is simply a name-value pair.
72-
73- While Elasticsearch uses a [ query DSL based on JSON] , in CrateDB, you can work
74- with Lucene Documents using SQL.
7590
7691
7792## Synopsis
@@ -155,7 +170,7 @@ Working with structured data and container data types in CrateDB.
155170```
156171For columns of type OBJECT, CrateDB supports different policies about the
157172behaviour with undefined attributes, namely STRICT, DYNAMIC, and IGNORED,
158- see [ ] ( inv: crate-reference# type-object-column-policy) .
173+ see {ref} ` crate-reference: type-object-column-policy ` .
159174
160175:STRICT:
161176 Reject any sub-column that is not defined upfront.
@@ -175,9 +190,9 @@ see [](inv:crate-reference#type-object-column-policy).
175190```
176191To support querying DYNAMIC OBJECTs using SQL, where keys may not exist within
177192an OBJECT, CrateDB provides the [ error_on_unknown_object_key] session setting.
178- It controls the behaviour of querying unknown object keys to dynamic objects.
193+ It controls the behaviour when querying unknown object keys to dynamic objects.
179194
180- By default, CrateDB will throw an error if any of the queried object keys are
195+ By default, CrateDB will raise an error if any of the queried object keys are
181196unknown. When adjusting this setting to ` false ` , it will return ` NULL ` as the
182197value of the corresponding key.
183198
@@ -217,13 +232,7 @@ container data types.
217232:::{grid-item} ** Blog: Handling Dynamic Objects in CrateDB**
218233:columns: 9
219234
220- CrateDB combines the advantages of typical SQL databases and strict
221- schemas with the dynamic properties of NoSQL databases. While traditional
222- object-relational databases allow you to store and process JSON data only
223- opaquely, CrateDB handles objects as first-level citizens.
224-
225- This allows users to access object properties in the same manner as columns
226- in a table, including full-text indexing and aggregation capabilities.
235+ Learn fundamentals about CrateDB's OBJECT data type.
227236:::
228237
229238:::{grid-item}
@@ -232,6 +241,7 @@ in a table, including full-text indexing and aggregation capabilities.
232241[ Handling Dynamic Objects in CrateDB]
233242
234243{tags-primary}` Fundamentals ` \
244+ {tags-secondary}` OBJECT `
235245{tags-secondary}` SQL `
236246:::
237247
@@ -252,8 +262,9 @@ as video [Getting Started with CrateDB Objects].
252262
253263[ Objects in CrateDB]
254264
255- {tags-primary}` Fundamentals ` \
256- {tags-secondary}` Docker `
265+ {tags-primary}` Fundamentals `
266+ {tags-primary}` Docker ` \
267+ {tags-secondary}` OBJECT `
257268{tags-secondary}` SQL `
258269:::
259270
@@ -265,7 +276,8 @@ as video [Getting Started with CrateDB Objects].
265276:::{grid-item} ** Querying Nested Structured Data**
266277:columns: 9
267278
268- Today's data management tasks need to handle multi-structured data from
279+ Today's data management tasks need to handle multi-structured and
280+ {ref}` nested <crate-reference:sql_dql_nested> ` data from
269281different data sources. CrateDB's dynamic OBJECT data type allows you to
270282store and analyze complex and nested data efficiently.
271283
@@ -277,10 +289,11 @@ URLs.
277289:::{grid-item}
278290:columns: 3
279291
280- [ ] ( inv: cloud# object)
292+ {ref} ` cloud: object `
281293
282- {tags-primary}` Fundamentals ` \
283- {tags-secondary}` CrateDB Cloud `
294+ {tags-primary}` Fundamentals `
295+ {tags-primary}` CrateDB Cloud ` \
296+ {tags-secondary}` OBJECT `
284297{tags-secondary}` SQL `
285298:::
286299
@@ -317,9 +330,10 @@ data types.
317330<iframe width =" 240 " src =" https://www.youtube-nocookie.com/embed/aQi9MXs2irU?si=J0w5yG56Ld4fIXfm " title =" YouTube video player " frameborder =" 0 " allow =" accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share " allowfullscreen ></iframe >
318331
319332** Date:** 10 Aug 2022 \
320- ** Speakers :** Rafaela Sant'ana
333+ ** Speaker :** Rafaela Sant'ana
321334
322335{tags-primary}` Fundamentals ` \
336+ {tags-secondary}` OBJECT `
323337{tags-secondary}` SQL `
324338:::
325339
@@ -346,35 +360,70 @@ nested data.
346360<iframe width =" 240 " src =" https://www.youtube-nocookie.com/embed/S_RHmdz2IQM?si=J0w5yG56Ld4fIXfm " title =" YouTube video player " frameborder =" 0 " allow =" accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share " allowfullscreen ></iframe >
347361
348362** Date:** 15 May 2023 \
349- ** Speakers :** Georg Traar
363+ ** Speaker :** Georg Traar
350364
351365{tags-primary}` Fundamentals ` \
366+ {tags-secondary}` OBJECT `
352367{tags-secondary}` SQL `
353368:::
354369
355370::::
356371
357372
373+ ::::{info-card}
374+
375+ :::{grid-item} ** Dynamic Schemas and Indexing Objects**
376+ :columns: 8
377+
378+ Learn more about OBJECTs from the perspective of dynamic schema evolution
379+ and about OBJECT indexing.
380+
381+ - [ Dynamic Schemas and Indexing Objects]
382+
383+ :::
384+
385+ :::{grid-item}
386+ :columns: 4
387+
388+ <iframe width =" 240 " src =" https://www.youtube-nocookie.com/embed/lp51GphV9vo?start=495&si=J0w5yG56Ld4fIXfm " title =" YouTube video player " frameborder =" 0 " allow =" accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share " allowfullscreen ></iframe >
389+
390+ ** Date:** 20 Mar 2023 \
391+ ** Speaker:** Marija Selakovic
392+
393+ {tags-primary}` Fundamentals ` \
394+ {tags-secondary}` OBJECT `
395+ {tags-secondary}` SCHEMA `
396+ :::
397+
398+ ::::
399+
400+
401+
358402:::{seealso} ** Product:**
359403[ Multi-model Database] •
360404[ JSON Database] •
361405[ Dynamic Database Schemas] •
362- [ Nested Data Structure]
406+ [ Nested Data Structure] •
407+ [ Relational Database]
363408:::
364409
365410
366- ``` {include} /_include/styles.html
367- ```
368-
369411
370- [ Dynamic Database Schemas ] : https://cratedb.com/product/features/dynamic-schemas
412+ [ Dynamic Schemas and Indexing Objects ] : https://youtu.be/lp51GphV9vo?t=495s&feature=shared
371413[ error_on_unknown_object_key ] : inv:crate-reference#conf-session-error_on_unknown_object_key
372414[ generated columns ] : #generated-columns
373415[ Getting Started with CrateDB Objects ] : https://youtu.be/aQi9MXs2irU?feature=shared
374416[ Handling Dynamic Objects in CrateDB ] : https://cratedb.com/blog/handling-dynamic-objects-in-cratedb
375- [ JSON Database ] : https://cratedb.com/solutions/json-database
376- [ Multi-model Database ] : https://cratedb.com/solutions/multi-model-database
377- [ Nested Data Structure ] : https://cratedb.com/product/features/nested-data-structure
378417[ Objects in CrateDB ] : https://community.cratedb.com/t/objects-in-cratedb/1188
379418[ query DSL based on JSON ] : https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html
380419[ Unleashing the Power of Nested Data: Ingesting and Querying JSON Documents with SQL ] : https://youtu.be/S_RHmdz2IQM?feature=shared
420+
421+ <!-- shared -->
422+ [ Dynamic Database Schemas ] : https://cratedb.com/product/features/dynamic-schemas
423+ [ JSON Database ] : https://cratedb.com/solutions/json-database
424+ [ Multi-model Database ] : https://cratedb.com/solutions/multi-model-database
425+ [ Nested Data Structure ] : https://cratedb.com/product/features/nested-data-structure
426+ [ Relational Database ] : https://cratedb.com/solutions/relational-database
427+
428+ ``` {include} /_include/styles.html
429+ ```
0 commit comments