javascript - Firebase retrieve from array of keys -


i'm working on project, using firebase, , i'm trying users ids intersect provided array. while javascript, i've added typescript types in order make things little easier follow.

const getusers = (userkeys: string[]) => {   // each id in `userkeys`, go user } 

my data looks following:

{   "qwertyuiop": {     "firstname": "bob",     "lastname": "test",     "emailaddress": "bob@test.com",   },   "asdfghjkl": {     "firstname": "jake",     "lastname": "alsotest",     "email": "jake@email.com",   } } 

obviously, have more data, goal provide array of ids getusers function, , either make successive calls, or batch users ids match. have decent experience in firebase, , project, using firebase-admin, , have little-to-no experience using admin sdk javascript.

i've experimented using bluebird promise library, couldn't past [promise { <pending> }, promise { <pending> }], and, unfortunately, asynchronous code won't work here. i'm looking advice on how solve problem, i'm afraid won't anywhere.

i have tried following implementations:

  • mapping on each item in userkeys array , performing:

    database .child('users') .child(key) .once('value', ...)

  • same, foreach

  • promise.map

  • promise.each

  • pushing each promise array, , returning promise.all

literally nothing seems work. i'm @ such loss here...


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -