Answers for "how to get only the document ids from firestore"

3

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
4

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

Code answers related to "how to get only the document ids from firestore"

Browse Popular Code Answers by Language