Reputation: 519
I have the following listener:
firebaseDB.ref(`organizations/${org_id}/requests`)
.orderByChild('employee_id')
.equalTo(employee_id)
.on('value', snapshot => {
// do some stuff
})
I always turn it off using the above query:
firebaseDB.ref(`organizations/${org_id}/requests`)
.orderByChild('employee_id')
.equalTo(employee_id)
.off()
but I was wondering if it is ok to turn it off in a parent node such as organization or request?, assuming I'm not listening to anything else.
firebase.ref(`organization/${org_Id}`).off()
or
firebaseDB.ref(`organizations/${org_id}/requests`).off()
Thank you in advance!
Upvotes: 1
Views: 475
Reputation: 317372
No, you should use the same Query object that was originally used to add the listener.
Upvotes: 1