Skip to content

Commit

Permalink
Update jsoniq-tutorial.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLichtenberger authored Apr 19, 2024
1 parent 4b27e2b commit 07fddff
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/jsoniq-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,29 @@ jn:load('mycol.jn','mydoc.jn','https://raw.githubusercontent.com/sirixdb/sirix/m

## Indexing


### Name / object field indexes

```xquery
jn:store('json-path1','mydoc.jn','[{"test": "test string"},{"test": ["a", {"testfield": "test blabla string", "foo": {"testfield": true}}, null, "b", "c"]}]')
```

```xquery
let $doc := jn:doc('mycol.jn','mydoc.jn')
let $stats := jn:create-name-index($doc, ('testfield','test'))
return {"revision": sdb:commit($doc)}
```

```xquery
let $doc := jn:doc('mycol.jn','mydoc.jn')
let $nameIndexNumber := jn:find-name-index($doc, 'testfield')
for $node in jn:scan-name-index($doc, $nameIndexNumber, 'testfield')
order by sdb:revision($node), sdb:nodekey($node)
return {"nodeKey": sdb:nodekey($node), "path": sdb:path($node), "revision": sdb:revision($node)}
```

### Path indexes

### CAS (content-and-structure) indexes

```xquery
Expand Down

0 comments on commit 07fddff

Please sign in to comment.