<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1441745859384_3783">I'm trying to figure out how to iterate through an indexed $avp that holds json query results. The docs are kind of spotty. Can someone share a working snippet of code that iterates through an $avp ? This one isn't quite working for me. First off it says only $var and $avp can be iterated, but this example has a $json var.<br></div><div id="yui_3_16_0_1_1441745859384_3782"><br></div><pre id="yui_3_16_0_1_1441745859384_3769" class="" style="font-size: 0.9em; font-family: 'Lucida Console', 'Andale Mono', 'Courier New', Courier; margin-top: 0px; margin-bottom: 0px; padding: 6px; border: 1px solid rgb(235, 235, 235); color: rgb(102, 102, 102); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21.5933px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(251, 254, 250);"># iterate through all JSON documents returned by a MongoDB query
cache_raw_query("mongodb:location", "{... find ...}", "$avp(res)");
for ($json(contact) in $(avp(res)[*]))
xlog("Found: $json(contact/phone) $json(contact/email)\n");<br></pre><div id="yui_3_16_0_1_1441745859384_3629"><br></div></div></body></html>