json - Marklogic search inside array or objects and return only matching array items (javascript) -




is possible search across documents search using specific properties inside array elements? furthermore possible results contain matching array elements , not whole document (as other array elements in same document may not match).

example: given json marklogic document { "name": "aname", "children": [{ "name": "a", "target": { "min": 2, "max": 10 } },{ "name": "b", "target": { "min": 22, "max": 32 } },{ "name": "c", "target": { "min": 4, "max": 7 } }] } want match children target.min < 5 , target.max > 5.

in case children[0] , children[2] match. how specify query return only: [ { "name": "a", "target": { "min": 2, "max": 10 } }, { "name": "c", "target": { "min": 4, "max": 7 } } ]

how construct relevant query. n.b. i'd prefer server side javascript or node.js implementation.

for node.js, take @ querybuilder.extract or search response transformations see if either of meet needs. both topics discussed under here: http://docs.marklogic.com/guide/node-dev/search#id_24160.

in sjs, jsearch mapper , reducer hook provides similar capabilities. see following topic on "transforming results map , reduce": http://docs.marklogic.com/guide/search-dev/javascript#id_49222.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -