Created
September 25, 2012 23:46
-
-
Save myoung34/3785143 to your computer and use it in GitHub Desktop.
Collections the correct way - no collections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $docs := | |
fn:distinct-values( | |
for $i in cts:search(//beef,cts:word-query("tip")) return | |
fn:base-uri($i) | |
) | |
let $favorites := | |
<favorites>{ | |
for $i in $docs return | |
<doc>{$i}</doc> | |
}</favorites> | |
return | |
xdmp:document-insert( | |
'/marc/favorites', | |
$favorites | |
) | |
(: 1 document affected - Profile 2643 Expressions PT0.326612S :) | |
let $docs := | |
fn:distinct-values( | |
for $i in cts:search(//pork,cts:word-query("ham")) return | |
fn:base-uri($i) | |
) | |
let $favorites := | |
<favorites>{ | |
for $i in $docs return | |
<doc>{$i}</doc> | |
}</favorites> | |
return xdmp:node-replace(fn:doc('/marc/favorites')/favorites,$favorites) | |
(: 1 document affected - Profile 2144 Expressions PT0.67532S :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment