How to get values from a document based on a reference in Firestore?

I have two collections in Firestore, contacts and techs, one of the contacts value is a reference to one of the techs documents, I am setting this reference using the path collection name + id, which I get after fetching techs:


As can be seen it works:

enter image description here

I can retrieve it without any problems:

const getContacts = () => {
    return db.collection('contacts').get()
window.addEventListener('DOMContentLoaded', async e => {
    const querySnapshot = await getContacts()

    querySnapshot.forEach(doc => {
        console.log('Reference value')
        console.log('Reference path')

enter image description here

But I couldn’t find a way to use this reference to actually get the value it is pointing to in techs collection.

How could I achieve this?


The icon field is actually a DocumentReference itself, so you can call get() on it to retrieve the document that it refers to.