Firestore user_ref.update is not a function

I'm trying to update a document from a collection, with below lines of code

async function updateAbout(about_me){
    try {

        let user_ref = db.collection("users").where("uid", "==", $current_user.uid)
        await user_ref.update({about_me})

    } catch (error) { console.error("Can't update", error)

I'm getting the following error:

TypeError: user_ref.update is not a function

1 answer

  • answered 2020-11-25 07:24 Peter Haddad

    where() returns a Query, which does not have an update() method. You need to do the following:

    let user_ref = await db.collection("users").where("uid", "==", $current_user.uid).get();
    user_ref.forEach(doc => {
       const docRef = db.collection("users").doc(;

    First get all the documents then iterate to get the document's id and update each document.