javascript - Firebase App Script getData() optQueryParameters with integer error -
so i'm looking using google spreadsheet display data firebase.
how ever data can times big google sheets handle.
i wanted limit data last 10 records.
i wanted order key
, last 10 records.
var records = base.getdata("path/foo", {"limittolast": 10 , "orderby":"key"});
the problem documentation shows optqueryparameters
supported no show how use them. above closest have gotten. still not work , errors
edit:
so have been keeping @ , think got order sorted not limittolast
var records = base.getdata("path/foo", { ".indexon": "key", ".limittolast":"2"});
has 1 got limittolast work on app script?
edit2:
here latest version have used:
var records = database.getdata("40274400", {"limittolast": 1 , "orderby":"$key"});
how ever can't limittolast work. sends error with: error limittolast must integer (line 135).
yes know integer weird.
the syntax specify order-by-key $key
:
var records = database.getdata("40274400", {"limittolast": 1 , "orderby":"$key"}); (var key in records) { logger.log(key+"="+records[key]); }
this logs value of last child under 40274400
.
update:
if get:
limittolast must integer
you using version 12 or earlier of firebaseapp library. sure upgrade version 13 or later.
Comments
Post a Comment