Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push multiple objects at once #76

Open
aaossa opened this issue Jun 9, 2017 · 1 comment
Open

Push multiple objects at once #76

aaossa opened this issue Jun 9, 2017 · 1 comment

Comments

@aaossa
Copy link

aaossa commented Jun 9, 2017

Hi, I'm trying to push multiple objects using one requests but I couldn't fin a way to do this using this gem. See this SO question for reference, it's in JS but the problem is the same. It looks like it is possible to push multiple objects at once using JS, so I think should be possible using this gem.

What I want is to start from something like this:

|> container
  |> -Km4sgiVoeXVx4ZLKe9a # parent_id
    |> div

Then I push multiple objects. Something like firebase.push("container/#{parent_id}/div", array), with an array like [{ a_key: A}, { a_key: B}, { a_key: C}] (currently this assigns the array index as ID).

Desired output:

|> container
  |> -Km4sgiVoeXVx4ZLKe9a # parent_id
    |> div
      |> -Km8IlUaZfgrrUB5tXQt # <= This is one of the objects I want to create
        |> a_key: A
      |> -Km8NBTEsaM1ElVBHNfH # <= Another created object
        |> a_key: B
      |>  -Km8NDYxTc0ldb_XV7Ti # <= Another created object
        |> a_key: C

Can I accomplish this using this gem? Is there another way to do this with just one request? Thanks!

@vincentwoo
Copy link
Collaborator

It may not be possible. Reading https://firebase.google.com/docs/reference/rest/database/ doesn't give an indication that they allow pushing multiple objects via REST. However, if you can generate an equivalent cURL request that does what you want, we can probably get this library to do the right thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants