This is surprisingly simple:
adaRef.toString()
Prints the full URL: https://<your-app>firebaseio.com/users/ada
So, just to get the path, you substitute it there. Two ways to do this:
adaRef.toString().substring(firebase.database().ref().toString().length-1)
or
adaRef.toString().substring(adaRef.root.toString().length-1)
both will print /users/ada
source
share