polymerfire icon indicating copy to clipboard operation
polymerfire copied to clipboard

Should allow an equalTo query with a 'null' value so that the client …

Open johnlim opened this issue 8 years ago • 5 comments

…is able to query for data that does not have a specific key.

I believe there should a more elegant solution but this works and we have a test in place.

johnlim avatar Oct 25 '16 09:10 johnlim

@johnlim How do you use this equal-to attribute? I pass a value and i get undefined

JGSolutions avatar Jun 28 '17 18:06 JGSolutions

@JGSolutions like this:

   <firebase-query
      id="query"
      path="[[path]]"
      data="{{data}}"
      app-name="appName"
      equal-to="null"
      equal-to-null>
    </firebase-query>

johnlim avatar Jun 30 '17 02:06 johnlim

This might have bad side effects where a particular value in the database would have a string "null" (which I don't know why they would do that but it will happen)

But having another flag called equal-to-null might be hackish in a sense that it is not really part of the firebase doc spec.

I don't know if it is possible to have it this way

<firebase-query
      id="query"
      path="[[path]]"
      data="{{data}}"
      app-name="appName"
      equal-to="[[equalTo]]">
    </firebase-query>

and have it equalTo = null then wrap around a checker that checks if it is undefined to not set equalTo

tjmonsi avatar Sep 21 '17 17:09 tjmonsi

According to the official docs it’s perfectly fine pass null as a value. However there’s a strict comparison to null here: https://github.com/firebase/polymerfire/blob/f1073078115b72280984d5d9b1c88d75f510fc9a/firebase-query.html#L263

It was introduced in #98 as a fix to #59 by @mbleigh

It seems to me that the comparison should be made against undefined.

I’ll try to make a PR for this in the coming days.

merlinnot avatar Jan 05 '18 21:01 merlinnot

This would be helpful. Can this be merged now?

jared-unify avatar Feb 14 '18 22:02 jared-unify