Nico
Nico

Reputation: 6359

Get path property of a reference

In the latest Node.js Admin SDK version, the path property of an admin.database.Reference is deprecated. I need to know the path and looks like soon I won't be able to use it. And they don't provide any new method to call so I'm wondering if I missed something, how I could get that path.

I can always do a ref.toString() and remove the base URL but I feel it might be more a hack than a proper solution. Any advice?

Upvotes: 1

Views: 321

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599856

Looking at this pull request on the Admin SDK open-source repo, it looks like the path property was deprecated to create type compatibility between the JavaScript/web SDK and the Node.js Admin SDK.

The client-side JavaScript SDK for Firebase Realtime Database never had a path property. The way to get the path has always been to call toString() explicitly, or to include the reference in a string concatenation. So it's not a hack, but the longstanding way to accomplish what you want.

Also see:

Upvotes: 2

Related Questions