Answers for "get doc id firestore"

2

get one document based on id in firestore

//retrieve one document and save it to userDetails
const [userDetails, setUserDetails] = useState('')
db.collection('users').doc(id).get()
        .then(snapshot => setUserDetails(snapshot.data()))
Posted by: Guest on June-28-2020
1

firestore get id of new document

async function addCity(newCity) {
  const { id } = await db.collection("cities").add(newCity)
  console.log("the new city's id:", id)
}
Posted by: Guest on November-30-2020
0

get document id from firestore

##get document id from firestore
https://stackoverflow.com/questions/53605611/firestore-flutter-how-can-i-get-document-id
Posted by: Guest on October-04-2021
0

get doc id firestore

const racesCollection: AngularFirestoreCollection<Race>;
return racesCollection.snapshotChanges().map(actions => {       
  return actions.map(a => {
    const data = a.payload.doc.data() as Race;
    data.id = a.payload.doc.id;
    return data;
  });
});
Posted by: Guest on December-30-2020

Code answers related to "get doc id firestore"

Browse Popular Code Answers by Language