Custom Element using data from a collection

How do you connect a custom element to data from a collection?

On the support page (https://support.wix.com/en/article/custom-element-faqs) its says the following:

'Can I Connect Custom Elements to Data in a Collection? 
Yes, you can connect custom elements to collections using Corvid's  [Data](https://www.wix.com/corvid/reference/wix-data.html)  and  [Dataset](https://www.wix.com/corvid/reference/wix-dataset.html)  APIs.' 

I couldn’t figure out how it works.

See the Dropdown Custom Element example which uses the results of a database query to populate a custom dropdown element.

Ok, the live demo works but when i go to edit the example the preview does not work because it has an async / await function in the custom element.

Also once i chose an option in the drop down how do I get the value in my page file

//Edit
I have got the dropdown working in preview now. I just need to be able to access the chosen value of the dropdown in the main page file so i can write it to my database