RomainVialard / FirebaseApp

Google Apps Script binding for Firebase Realtime Database
Apache License 2.0
116 stars 30 forks source link

PushData without inserting unique subpath #8

Closed jrob256 closed 6 years ago

jrob256 commented 6 years ago

Looking for a feature to be added. If the pushdata method could optionally push directly into the path.

Currently, if I use the pushdata method it will add a subpath with a unique id under the selected path. It would be great if that object information could be added directly under the specified path instead of creating a subPath with the unique id.

I could loop through to create a record every time but this will be very slow.

This could be useful if I need to add multiple spreadsheets to a single database but do not want to overwrite the information.

JeanRemiDelteil commented 6 years ago

Hello @jrob256 , The push command is designed to push new data with a unique key identifier: Here is the related documentation for: push

You can achieve what you described using an update. Here is the doc for: update

Read this documentation from Firebase, it provides a great example: https://firebase.google.com/docs/database/web/read-and-write#update_specific_fields