Documents
Document selectors, mutation helpers, and generated helper inventory.
Document helper inventory
| Helper | Canonical | Status | Projection | Predicate | Selector type | Diagnostic |
|---|---|---|---|---|---|---|
doc_get_text | doc_get_text | supported | supported | equality_range_in | string | |
doc_get_int | doc_get_int | supported | supported | equality_range_in | number_exact_int32 | non-integral or out-of-range JSON numbers project as NULL |
doc_get_bigint | doc_get_bigint | supported | supported | equality_range_in | number_exact_int64 | non-integral or out-of-range JSON numbers project as NULL |
doc_get_boolean | doc_get_boolean | supported | supported | equality_in | boolean | |
doc_get_bool | doc_get_boolean | alias | supported | equality_in | boolean | compatibility alias for doc_get_boolean |
doc_get_vector | doc_get_vector | supported | supported | ann_order_by | vector | fixed-shape document vector helper requires a positive dimension argument |
doc_path_state | doc_path_state | supported | supported | equality_in | path_state | explicit path-state selector; DOC_STATE_VALUE=0, DOC_STATE_NULL=1, DOC_STATE_MISSING=2, DOC_STATE_MISMATCH=3 |
doc_get_number | doc_get_number | supported | supported | equality_range_in | number | uses document_number_selector_key_codec:v1:cql_decimal_canonical_bytes for selector equality and range ordering |
doc_is_null | doc_is_null | supported | supported | equality_true_in_true | path_state | explicit null-state helper; predicates admit true only and bind to DOC_STATE_NULL |
doc_contains_path | doc_contains_path | supported | supported | equality_in | path_state | bounded document path existence helper; true for value or explicit null, false for missing or mismatch |
doc_jsonpath_match | doc_jsonpath_match | supported | supported | equality_in | boolean | bounded fixed-shape JSONPath subset: one rooted selector, optional single wildcard, scalar comparison or existence |
doc_contains | doc_contains | supported | supported | equality_in | any | bounded exact containment helper for object containment and scalar-array membership verification |
doc_set | doc_set | reserved | refused | mutation_only | document | document mutation remains on the D4B UPDATE surface, not SELECT helper predicates |
doc_delete | doc_delete | reserved | refused | mutation_only | document | document mutation remains on the D4B UPDATE surface, not SELECT helper predicates |
doc_merge_patch | doc_merge_patch | reserved | refused | mutation_only | document | document mutation remains on the D4B UPDATE surface, not SELECT helper predicates |
doc_inc | doc_inc | reserved | refused | mutation_only | document | document mutation remains on the D4B UPDATE surface, not SELECT helper predicates |
doc_array_append | doc_array_append | reserved | refused | mutation_only | document | document mutation remains on the D4B UPDATE surface, not SELECT helper predicates |
doc_array_remove | doc_array_remove | reserved | refused | mutation_only | document | document mutation remains on the D4B UPDATE surface, not SELECT helper predicates |
Examples
Document selectors
CREATE INDEX events_doc_category_idx
ON app.events (doc_get_text(doc, '$.category'))
USING 'sis'
WITH OPTIONS = {'family':'auto'};
WAIT FOR INDEX events_doc_category_idx QUERYABLE TIMEOUT '60 seconds';
SELECT id, doc_get_text(doc, '$.category') AS category
FROM app.events
WHERE tenant = 'tenant-alpha'
AND doc_get_text(doc, '$.category') = 'returns'
LIMIT 20;
Supported document projection and predicate helper families include:
| Helper family | Predicate use |
|---|---|
doc_get_text, doc_get_int, doc_get_bigint, doc_get_number | Equality, IN, and bounded ranges when a matching queryable selector exists. |
doc_get_boolean / doc_get_bool | Equality and IN. |
doc_get_vector | ORDER BY doc_get_vector(...) ANN OF ... with a queryable vector selector. |
doc_path_state, doc_is_null, doc_contains_path | Explicit value/null/missing/mismatch/path-existence state checks. |
doc_jsonpath_match, doc_contains | Bounded fixed-shape JSONPath and exact-containment subsets. |
Examples
Document mutation functions
Document mutations are UPDATE assignment helpers, not SELECT helpers.
UPDATE app.events
SET doc = DOC_SET(doc, '$.priority', 'critical', true)
WHERE tenant = 'tenant-alpha' AND id = 'e1';
UPDATE app.events
SET doc = DOC_DELETE(doc, '$.deprecated')
WHERE tenant = 'tenant-alpha' AND id = 'e1';
UPDATE app.events
SET doc = DOC_MERGE_PATCH(doc, fromJson('{"category":"returns","tags":["vip"]}'))
WHERE tenant = 'tenant-alpha' AND id = 'e1';
UPDATE app.events
SET doc = DOC_INC(doc, '$.retry_count', 1)
WHERE tenant = 'tenant-alpha' AND id = 'e1';
UPDATE app.events
SET doc = DOC_ARRAY_APPEND(doc, '$.tags', 'urgent')
WHERE tenant = 'tenant-alpha' AND id = 'e1';
UPDATE app.events
SET doc = DOC_ARRAY_REMOVE(doc, '$.tags', 'stale')
WHERE tenant = 'tenant-alpha' AND id = 'e1';