When I had problems with Cors I use overload of methods in my SuperClass to solve this problem.

ClassMethod HandleDefaultCorsRequest(pUrl As %String) As %Status [ Private ]
{
    Do %response.SetHeader("Access-Control-Allow-Origin","*")
    Do %response.SetHeader("Access-Control-Allow-Credentials","true")
    Do %response.SetHeader("Access-Control-Allow-Methods","GET, PUT, POST, DELETE, PATCH, OPTIONS")
    Do %response.SetHeader("Access-Control-Allow-Headers","Access-Control-*, Content-Type, Authorization, Accept, Accept-Language, X-Requested-With, Origin")
    
    Quit $$$OK
}

With the bellow code, you will can count all nodes.

USER>S COUNTRY="",COUNT=0,NIV=""
USER>F  S COUNTRY=$O(^Locations(COUNTRY)) Q:COUNTRY=""  F  S NIV=$O(^Locations(COUNTRY,NIV)) Q:NIV=""  S COUNT=COUNT+1
USER>W COUNT
5
 

Count only USA

USER>S COUNTRY="USA",COUNT=0,NIV=""
USER>F  S NIV=$O(^Locations(COUNTRY,NIV)) Q:NIV=""  S COUNT=COUNT+1
USER>W COUNT
3
 

Count only Canada

USER>S COUNTRY="Canada",COUNT=0,NIV=""
USER>F  S NIV=$O(^Locations(COUNTRY,NIV)) Q:NIV=""  S COUNT=COUNT+1
USER>W COUNT
2