score:0

this line will look up the doc which names 'data.user.id'.

.doc(data.user.uid)

if you want to find the result by uid you should use it like

const posts = await firebase.firestore()
    .collection("users")
    .where('uid', '==', uid)
    .get();

rememeber this will return a post collection but a post itself.

update

var usersref = ref.child("users");
usersref.set({
  alanisawesome: {
    date_of_birth: "june 23, 1912",
    full_name: "alan turing"
  },
  gracehop: {
    date_of_birth: "december 9, 1906",
    full_name: "grace hopper"
  }
});

var hopperref = usersref.child("gracehop");
hopperref.update({
  "nickname": "amazing grace"
});

see the full docs here


Related Query

More Query from same tag