...
When we try to query the entire list, we get DataNodeNotFound exception because there is no data node with the xpath representing a list in the database. Ex: /bookstore/categories
"id" | "xpath" | "attributes" | "parent_id" |
---|---|---|---|
200 | "/bookstore/categories[@book-category='Kids']" | "{""name"": ""Kids book"", ""price"": 5000, ""stock"": true, ""book-category"": ""Kids""}" | 198 |
199 | "/bookstore/categories[@book-category='SciFi']" | "{""name"": ""Test book"", ""price"": 1000, ""stock"": false, ""book-category"": ""SciFi""}" | 198 |
198 | "/bookstore" | "{""store-name"": ""My Bookstore"", ""store-owner"": ""ABC""}" | null |
Code Block | ||
---|---|---|
| ||
WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths) |
...
And this would return 2 fragments as follows.
"id" | "xpath" | "attributes" | "parent_id" |
---|---|---|---|
200 | "/bookstore/categories[@book-category='Kids']" | "{""name"": ""Kids book"", ""price"": 5000, ""stock"": true, ""book-category"": ""Kids""}" | 198 |
199 | "/bookstore/categories[@book-category='SciFi']" | "{""name"": ""Test book"", ""price"": 1000, ""stock"": false, ""book-category"": ""SciFi""}" | 198 |
Impact on response body
The updated query returns child fragments when querying the entire list and it has the following impacts when compared to the existing response body.
...
Code Block | ||||
---|---|---|---|---|
| ||||
[ { "stores:bookstore": { "categories": [ { "name": "Test book", "price": 1000, "stock": false, "book-category": "SciFi" }, { "name": "Kids book", "price": 5000, "stock": true, "book-category": "Kids" } ], "store-name": "My Bookstore", "store-owner": "ABC" } } ] |
...
Code Block | ||||
---|---|---|---|---|
| ||||
[ { "stores:categories": { "name": "Test book", "price": 1000, "stock": false, "book-category": "SciFi" } }, { "stores:categories": { "name": "Kids book updated", "price": 5000, "stock": true, "book-category": "Kids" } } ] |
...
Code Block | ||||
---|---|---|---|---|
| ||||
[ { "stores:categories": { "name": "Test book", "price": 1000, "stock": false, "book-category": "SciFi" } }, { "stores:categories": { "name": "Kids book updated", "price": 5000, "stock": true, "book-category": "Kids" } } ] |
...