Closed dginovker closed 2 years ago
For completeness, some other things I tried -
orderBy | Result |
---|---|
orderBy: "$key" [1] |
Error: 400 - Provided key index type is invalid, must be string |
orderBy: "$value" [2] |
Error: 400 - Index not defined, add ".indexOn": ".value", for path "/url/data/path", to the rules |
orderBy: "$priority" [3] |
(Returned undefined ) |
orderBy: null |
Error: 400 - orderBy must be a valid JSON encoded path |
orderBy: "generic-index" * |
Error: 400 - Index not defined, add ".indexOn": "generic-index", for path "/url/data/path", to the rules |
orderBy: "%24key" ** |
Error: 400 - Index not defined, add ".indexOn": "%24key", for path "/url/data/path", to the rules |
* For generic-index, when I added ".indexOn": "generic-index"
to the rules at the right location, it just returned undefined
** %24 is the result of Javascript's encodeURIComponent("$")
so I gave that a shot
It seems like the dollar sign is being dropped so I can't index by key/value/priority properly
Misunderstood the documentation. "$key"
works,startAt
just needs to reference something about the key (it is NOT a numeric index). I.e. my code needs to be something like:
return base.getData("", {orderBy: "$key", startAt: "C"});
I was having the same issue as #23 and saw the solution to use limitToFirst & startAt for pagination as per the docs. To use startAt however, you need to use orderBy. Since my data on Firebase is in the format
I wanted to use orderBy="$key", however I get the following error:
Actual code used:
Omitting the second parameter on getData() entirely returns all the data, but since I have a lot of data it fails for the same reason as other users got in #23