Just noted that you are using a dynamic page. So in this case, assuming the url for the page is derived from your Contacts collection, what you should do is grab the related Conract info from the page URL using wixLocation.path[0]
This is essentially what the dynamic page router uses to set up the dynamicData set which will already be filtered for you.
Once you have the path name you can build your query…
import wixLocation from “wix-location”;
…
let filterValue = wixLocation.path[0];
wixData. Query(“Contacts”).eq(,filterValue).find()…
will be the name of the column used in your dynamic query. So if this is the Contact ID property then would be “id”.
See if this helps.