Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo Plugins Support › Firebase Delete Key

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16396

    Alec

    Hi, I’ve just been looking through the Firebase plugin docs. Looks great and simple to use as always.

    Can I ask what is the recommended way to delete a key from the database.

    How would I remove a user if the data is structured like in the example:

    {
      "public" : {
        "news" : "Firebase Plugin is now live!"
      },
      "users" : {
        "<user-id>" : {
         "username" : "John Doe",
         "age" : 22,
         "motto" : "Felgo is awesome!"
        }
      }
    }

    Cheers,

    alb

    #16397

    Alex
    Felgo Team

    Hi Alb,

    the Firebase documentation definitely needs some more examples đŸ™‚ You can use a path to access your keys, this is shortly demonstrated in this example, but we’ll also add it to the API documentation of the database item.

    // you can try
    firebaseDb.setValue("users/<user-id>", undefined);
    // or
    firebaseDb.setValue("users/<user-id>", null);

    Then you can check if a key is defined. Maybe it’s even better to introduce an own “deleted” property and set this one instead so you don’t lose the data and can possibly restore it.

    Hope that helps!

    Cheers,
    Alex

    #16398

    Alec

    Thanks for your quick reply. Great idea for retrieving data too.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded