Answers for "TypeError: database.collection(...).set is not a function at onFinish"

-2

TypeError: database.collection(...).set is not a function at onFinish

db.collection("users") returns an object of CollectionReference. CollectionReference has no function 'set', Hence the error. Perhaps you are looking for the function 'add' which adds documents.

Replace

                db.collection("users").set({
                    points: 0,
                    CurrentLevel: 0
                })
with

                db.collection("users").add({
                    points: 0,
                    CurrentLevel: 0
                })
And I think that should solve your problem
Posted by: Guest on December-15-2020

Code answers related to "TypeError: database.collection(...).set is not a function at onFinish"

Code answers related to "Javascript"

Browse Popular Code Answers by Language