Return all paths in provision script

Hello,
I’m having a problem understanding how I can return all paths matching a wildcard in a provision script.
For example if I have:
let connections_path=declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.*", {path: Date.now()}).path;

I expect connections_path to be an array (I have 4 WANIPConnection instances) but is actually a string containing just the first one. How can I get all existing paths?

From the docs:

The return value of declare() is an iterator to access parameters that match the given path. Each item in the iterator has the attribute ‘path’ in addition to any other attribute given in the declare() call. The iterator object itself has convenience attribute accessors which come in handy when you’re expecting a single parameter (e.g. when path does not contain wildcards or aliases).