polymerfire icon indicating copy to clipboard operation
polymerfire copied to clipboard

Create Denormalized Version of firebase-query

Open phidias51 opened this issue 7 years ago • 2 comments

The firebase-query element works well for querying a standard list of subnodes, but given that so much of what we have to do relies on querying, updating or deleting multiple nodes in the database it would be useful if that functionality were bundled into a "distributed-query" element.

For example, let's say that you have an employee node that lists all of the employees. And you have a team-employee node that lists the teams and all of the employees that belong to those teams. To query for all employees on a given team, you have to go to the relevant team-employee node and then add a child-added listener, and go fetch the appropriate employee node.

Since this is such a common usage pattern, it would be nice if this were wrapped up into an element.

<firebase-dist-query relational-node="team-employee" dep-node="employee" path="/team-employee/[[someTeamId]]" data="{{teamMembers}}"></firebase-dist-query>

phidias51 avatar Apr 07 '17 16:04 phidias51

Hey, Agreed that reconciling nodes while querying could be smoother.

For the time being, I use smth along the lines (firebase-nest available on webcomponent.org) :

  <firebase-nest path="/countryList" data="{{data}}">
    <template is="dom-repeat" items="{{data}}">
      <firebase-value key="code" data={{item}}" path="/countryNames/[[item.$key]]/country-code"></firebase-value>
    </template>
  </firebase-nest>

christophe-g avatar Apr 07 '17 16:04 christophe-g

@christophe-g That's cool! Have you seen anything that makes distributed updates and deletes easier?

phidias51 avatar Apr 07 '17 17:04 phidias51