running queries in firebase using async / await

ecmascript-2017, firebase, node.js

Solution

The result of `value` is a snapshot, we need 1 more step to get the value. This should be like:

const eventref = this.db.ref('cats/whiskers');
const snapshot = await eventref.once('value');
const value = snapshot.val();

Problem

Appreciating that firebase has added support for promises, is there a way to run a query like the following inside of an `async` function?: ``` const eventref = this.db.ref('cats/whiskers'); const value = await eventref.once('value') ``` Running the above returns a promise for `value`, I'm hoping to get the json blob that is stored at `cats/whiskers`.

Original source