Data in fire-base database is as below:
my intention is to interact with a single dictionary at a time, such as delete it from fire-base or update it. To do this i have to filter through the database with multiple filters such as by home_team and away_team
edit
I have been successful in filtering through the data to the specific dictionary i would like to remove. ps. add rules to firebase as followed here: adding rules to firebase
current code is as below:
import pyrebase
# firebase configuration
########################
config = {
...
}
firebase = pyrebase.initialize_app(config)
db = firebase.database()
games = db.child("basketball").order_by_key().order_by_child("home_team").equal_to("Singapore Slingers").get()
print(games.val()) # success
# now to delete
db.child("basketball").order_by_key().order_by_child("home_team").equal_to("Singapore Slingers").remove() # this clears the entire database even though i have filtered to the database i would like to remove
The expected result would be to delete the game whose home_team == 'Singapore Slingers' && away_team == 'CLS Knights Surabaya' from firebase real time database