GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
558 stars 79 forks source link

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

Closed CraigMLdsouza closed 4 months ago

CraigMLdsouza commented 4 months 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 4 months 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 months 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.