mobizt / FirebaseClient

🔥Async Firebase Client for Arduino. Supports Realtime Database, Cloud Firestore Database, Firebase Storage, Cloud Messaging, Google Cloud Functions and Google Cloud Storage.
MIT License
106 stars 6 forks source link

update boolean value #7

Closed jiperez11 closed 5 months ago

jiperez11 commented 5 months ago

I am trying to update write.create(obj1, "booleanValue", true); but in firebase RTDB the value 1 comes out

mobizt commented 5 months ago

You cannot use JsonWriter like that, you should use the boolean_t placeholder to make the bool string like the following.

write.create(obj1, "booleanValue", boolean_t(true))

That is because the function create assign what you passed to the function in the second argument to String buffer of object_t of the first argument.

String buf = true; // -> "1" which is the unexpected behavior of Arduino String class

String buf= boolean_t(true) // -> "true"

mobizt commented 5 months ago

This should be done using just bool too as in case of number.

I will update the library to fix this and inform you here.

mobizt commented 5 months ago

The library is updated to v1.0.3 and waits for Arduino Library Manager to update.