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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support