'Uncaught (in promise) FirebaseError: Function addDoc() called with invalid data. Unsupported field value: a function

Uncaught (in promise) FirebaseError: Function addDoc() called with invalid data. Unsupported field value: a function (found in field total in document orders/8Ep86a9aWM5URmDt96RP)

Estoy tratando de generard una orden y me sale ese error y no entiendo

 const db = getFirestore()
    const queryColection = collection(db, 'orders')
    addDoc(queryColection, orden)
      .then((resp) => setId(resp.id))
      .catch((err) => console.error(err))
      .finally(() => console.log("terminado"))


Solution 1:[1]

Not that much experience with Firebase, but I think this should fix it

const db = getFirestore()
const queryColection = collection(db, 'orders')
queryColection.add(orden)
  .then((resp) => setId(resp.id))
  .catch((err) => console.error(err))
  .finally(() => console.log("terminado"))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luiz Avila