Firebase (2016) Shallow Query

I'm trying out Firebase (since Google's new release).

In the original version of Firebase the parameter shallow=true would return an object with { key: true } for every key at the root of the tree/branch that was requested (and so, rather than children being returned, you would just know the fact that child(ren) exist). This is useful because you don't necessarily want all the data from the child nodes (particularly if there's a lot of it).

Is there a way to do that with Google's new version of Firebase? I'm thinking something like:

firebase.database().ref('/data/?shallow=true').once('value', function(snapshot) {
  // do something with snapshot

The above code's snapshot.val() returns null and if I'm reading the docs correctly, it seems this functionality is gone.



The ?shallow=true parameter in Firebase Database 2.x was only available in the REST API. See

In the new Firebase Database 3.x, the same parameter is still only available in the REST API. See

You're using a Firebase SDK (JavaScript from the looks of it), which never supported this parameter.

For more questions that have discussed this in the past, see:


This worked for me based on Frank's answer:

import request from 'request';

request({ url: "https://[YOUR-APP-ID]" }, (error, response, body) => {
    const shallowData = JSON.parse(body);



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.