GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
530 stars 76 forks source link

Firestore Update[BUG] #298

Closed Firty closed 2 years ago

Firty commented 2 years ago

var t0: FirestoreTask = Firebase.Firestore.collection(NAME_COLLECTION).update("NAME_DOCUMENT",{"00000000000":{"KEY0":"VALUE","KEY1":"VALUE","KEY2":"VALUE"}}). Return {code:400, message:Invalid property path "00000000000"., status:INVALID_ARGUMENT} Coment: there is a failure to issue: emit_signal(signal_name, error.code, error.status, error.message, task). But this has already been reported.

The function: static func dict2fields(dict : Dictionary) -> Dictionary: from firestore_document.gd. It's acting strange. I used print({'fields':fields}) before the return {fields:{KEY0:{stringValue:VALUE}, KEY1:{stringValue:VALUE}, KEY2:{stringValue:VALUE}}} {fields:{00000000000:{mapValue:{fields:{KEY0:{stringValue:VALUE}, KEY1:{stringValue:VALUE}, KEY2:{stringValue:VALUE}}}}}} Am I doing something wrong?

Another problem is using an integer da in a dictionary key {int->00000000000:{"KEY0":"VALUE","KEY1":"VALUE","KEY2":"VALUE"}} if "." in field: of the firestore_document.gd lock...

Firty commented 2 years ago

Just to increase... I manually entered these values ​​into Firestore. And I used the get function. Returned the following Field: {fields:{00000000000:{mapValue:{fields:{GEN:{stringValue:0}, NASC:{stringValue:16/12/1996}, NOME:{stringValue:ADRELINA DA SILVA LESSA}}}}, 00000000000:{mapValue:{fields:{GEN:{stringValue:1}, NASC:{stringValue:16/12/1994}, NOME:{stringValue:EZEQUIEL WILHELM RIBEIRO}}}}}}

When passing this dictionary in update, I received the following return: {fields:{00000000000:{mapValue:{fields:{mapValue:{mapValue:{fields:{fields:{mapValue:{fields:{GEN:{mapValue:{fields:{stringValue:{stringValue:0}}}}, NASC:{mapValue:{fields:{stringValue:{stringValue:16/12/1996}}}}, NOME:{mapValue:{fields:{stringValue:{stringValue:ADRELINA DA SILVA LESSA}}}}}}}}}}}}}, 00000000000:{mapValue:{fields:{mapValue:{mapValue:{fields:{fields:{mapValue:{fields:{GEN:{mapValue:{fields:{stringValue:{stringValue:1}}}}, NASC:{mapValue:{fields:{stringValue:{stringValue:16/12/1994}}}}, NOME:{mapValue:{fields:{stringValue:{stringValue:EZEQUIEL WILHELM RIBEIRO}}}}}}}}}}}}}}} Result of dict2fields(dict : Dictionary)

And return [Firebase Error] >> Action in error was: 2 {code:400, message:Invalid property path "00000000000"., status:INVALID_ARGUMENT}

I'm very confused!

BearDooks commented 2 years ago

@Firty I am not sure what is going on there. The wiki has some notes on how to use the function. https://github.com/GodotNuts/GodotFirebase/wiki/Firestore#update-a-document

There is also the test harness we use to test code before release. https://github.com/GodotNuts/GodotFirebaseTestHarness It has some good examples of how to do some things if you want to check it out. If that still doesn't work let me know and we can deep dive.

Thanks

Chuck

WolfgangSenff commented 2 years ago

Ahh, just saw this, sorry! You cannot have fields in Firestore that have integer keys. They are special to the internals of Firestore and reserved.