GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
517 stars 74 forks source link

[BUG] update function is not working in 4.2.2 #410

Closed CraigMLdsouza closed 4 weeks ago

CraigMLdsouza commented 1 month ago

Describe the bug I'm trying to call the update function on a collection using collection.update(document) where document is of type: FirestoreDocument. tried adding the name and field in dictionary format but it still doesnt work. I'm a little confused regarding the how the update function is to be used in the documentation as well.

To Reproduce func save_data(): var auth = Firebase.Auth.auth if auth.localid: var collection: FirestoreCollection = Firebase.Firestore.collection(COLLECTION_ID) var document = FirestoreDocument.new({"name": auth.localid, "fields": {'oranges': oranges}}) var task = await collection.update(document)

Environment:

WolfgangSenff commented 1 month ago

That is not how you create a document at the moment. If you want to add a document to Firestore, then the above is how you do it, of course with the except that you call add instead of update. It is required at the moment that, if you have a document in Firestore for it already, you have to get it first and then update it by updating the document. This is all documented in the wiki.

WolfgangSenff commented 4 weeks ago

I'm closing this now since I haven't heard back and what you've done is clearly wrong. Please see the wiki for more.