You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⭐️ This challenge is up for grabs! Claim it by clicking "assign yourself" on the right, under the "Assignees" section for this GitHub issue! You can work on this by yourself or in pairs.
✔️ To complete this challenge: Post a comment at the bottom of this page with some instructions and sample code, so the rest of our team can learn how to use this new Firebase method by reading your comment!
You can edit your comment at any point to update your answer, so you don't have to do these all at once! To edit your comment after you publish it, click the pencil icon in the top right corner of your comment:
❓ If you have any questions, please post a comment at the bottom of this page! (You can also ask us on Slack, but please post a comment here too so we can more easily reference it later.)
The remove method deletes data at the specified location in the database. If that database location contains any children (nested objects), they will all be deleted as well.
Your challenge
🏆 The goal: learn how this method works, test it out for yourself, and then post a comment at the bottom of this page with some instructions and sample code to help teach the rest of our team!
Questions to keep in mind:
What does the official documentation say about this method?
When would we need to use this method? What are some example use cases? (Write some sample code for us, please!)
When should we not use this method? Can you think of any scenarios where using this method would cause errors or unintended side effects?
How many inputs does this method require, if any? What data types can the inputs be?
What does this method return as an output, if any? What data type is returned?
If there are different options for inputs, how does this method behave differently depending on the different possible input(s)?
The text was updated successfully, but these errors were encountered:
It says this method returns a Promise containing void, which affects both the parent
and the child.
However, you can make it log whether the method was a success
via a non-null Promise:
The then() method returns a promise. Promises
"Promise has been fulfilled."
or not
"Promise not fulfilled : " + e.message
.then defines when a promise is fulfilled, so the code example (it's a good idea)
to have an exception handled in case the Promise is not fulfilled.
I guess you'd have to be careful about using the method in general,
because it's removing both the parent and child data.
eg.
var dbRef = firebase.database().ref('users/Joe');
dbRef.remove() // void function called
.then(function() { // .then indicates a Promise
console.log("Promise has been fulfilled.")
})
.catch(function(e){
console.log("Promise not fulfilled : " + e.message)
// if function fails, log the error message and tell us it failed
});
Thanks @kammitama5, great start on documenting this one as well! I wouldn't worry about the Promises part yet. Suggestions for improving your description/examples above:
Could you also describe what inputs this method takes? (There is an optional input, but it looks potentially useful!)
Create a couple more examples of using the remove() method without using any Promises -- since you definitely don't need to make use of Promises in order to use this method.
For any new example code you write, could you also make up an example of some fake data that would be in your database, and show what the database looks like before and then after calling the remove() method?
⭐️ This challenge is up for grabs! Claim it by clicking "assign yourself" on the right, under the "Assignees" section for this GitHub issue! You can work on this by yourself or in pairs.
✔️ To complete this challenge: Post a comment at the bottom of this page with some instructions and sample code, so the rest of our team can learn how to use this new Firebase method by reading your comment!
You can edit your comment at any point to update your answer, so you don't have to do these all at once! To edit your comment after you publish it, click the pencil icon in the top right corner of your comment:
![github-edit-comments](https://user-images.githubusercontent.com/1555022/27059741-06de4e70-4f8d-11e7-9076-53de602e5c6a.png)
❓ If you have any questions, please post a comment at the bottom of this page! (You can also ask us on Slack, but please post a comment here too so we can more easily reference it later.)
About the Firebase
remove
method📚 Official documentation: Firebase API section on the
remove
methodThe
remove
method deletes data at the specified location in the database. If that database location contains any children (nested objects), they will all be deleted as well.Your challenge
🏆 The goal: learn how this method works, test it out for yourself, and then post a comment at the bottom of this page with some instructions and sample code to help teach the rest of our team!
Questions to keep in mind:
The text was updated successfully, but these errors were encountered: