Firebase-admin-node: FR: Shallow reads support in realtime database API

Created on 16 Oct 2018  路  3Comments  路  Source: firebase/firebase-admin-node

Add support for shallow reads from the the realtime database.

The Python SDK support it: https://github.com/firebase/firebase-admin-python/pull/109
The Rest API support it: https://firebase.google.com/docs/reference/rest/database/#section-param-shallow

Most helpful comment

I found this based on hiranya's answer. Hopefully it works out for some people:

import request from 'request';

request({ url: "https://[YOUR-APP-ID].firebaseio.com/path/to/data/.json?shallow=true" }, (error, response, body) => {
    const shallowData = JSON.parse(body);
    console.log(shallowData);
});

Reference: https://firebase.google.com/docs/database/rest/retrieve-data#shallow

All 3 comments

Shallow reads cannot be supported in SDK implementations based on the WebSocket interface of RTDB. Python and Go support it since they are based on the REST interface.

Doesn't look like a good reason to me 馃槖

I found this based on hiranya's answer. Hopefully it works out for some people:

import request from 'request';

request({ url: "https://[YOUR-APP-ID].firebaseio.com/path/to/data/.json?shallow=true" }, (error, response, body) => {
    const shallowData = JSON.parse(body);
    console.log(shallowData);
});

Reference: https://firebase.google.com/docs/database/rest/retrieve-data#shallow

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StoryStar picture StoryStar  路  5Comments

jhuleatt picture jhuleatt  路  4Comments

cmdhema picture cmdhema  路  3Comments

peterwiebe picture peterwiebe  路  3Comments

perqin picture perqin  路  3Comments