I want to remove expired users in cat01.So i want to filter date from nodes and remove that user node only. Following is my firebase structure.

I tried this below code .It shows successfully .but the node is not deleted.
deleteData: function (req, callback, res) {
{
let userId = req.User;
const db = firebase.database()
let usersRef = db.ref("Foreign/").child(userId).child("Category").child("Cat01")
usersRef
.equalTo(uid)
.once("value")
.then(function (snapshot) {
snapshot.forEach((childSnapshot) => {
usersRef.child(childSnapshot.key).remove();
});
});
Method 2 i tried this way too .but it remove whole user from UserID. But i just want to remove uid="u001" when date is expired.it is successful until cat01.i think error cause because of index. May i know any method to access index there .
deleteData: function (req, callback, res) {
{
let userId = req.User;
const db = firebase.database()
let usersRef = db.ref("Foreign/").child(userId).child("Category").child("Cat01")
usersRef.remove()
.then(function() {
console.log("succeeded!")
})
.catch(function(error) {
console.log("failed: ",error)
});