this my table structure
Chats:
-LwNV3HExAT2HR44dgJk
hotel_id: "43"
isseen: "false"
message: "hello"
receiver: "8"
sender: "4"
time: "31/11/2019 00:00:00"
-LwNOpLvg6bPvXGFhfJk
hotel_id: "44"
isseen: "false"
message: "hello"
receiver: "8"
sender: "5"
time: "01/12/2019 00:00:00"
i want to update value of isseen to true when i click on the button and call the function SetSeen()
isseen is updated when the "sender" is equal to 5 / and "hotel_id" equal to 44 / and "receiver" is equal to 8
i just do one of this condition "sender"="5" in my function as below
SetSeen = () => {
var db = firebase.database();
var query = db.ref("Chats").orderByChild("sender").equalTo("5");
query.on("child_added", function (snapshot) {
snapshot.ref.update({ isseen: "true" })
});
}
and i don't have a solution to pass the other conditions ,Can somebody help me please