Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script>
  <title>Query for absence of a property</title>
</head>
<body>
</body>
</html>
 
  var config = {
    apiKey: "AIzaSyCvpYQu44zmRXA0XQkcxEuakyytRsnWXSc",
    authDomain: "stackoverflow.firebaseapp.com",
    databaseURL: "https://stackoverflow.firebaseio.com",
    storageBucket: "project-8080059325282098184.appspot.com",
  };
  firebase.initializeApp(config);
var ref = firebase.database().ref("/39195191");
var userId = 1;
function listenTo(name, query) {
  query.once('value', function(snapshot) {
    console.log(name+': resulted in '+snapshot.numChildren()+' results');
    snapshot.forEach(function(child) {
      console.log(child.key+': '+JSON.stringify(child.val(), null,'  '));
    });
  });
}
listenTo(
  'absence of child prop', 
  ref.orderByChild('child').equalTo(null)
);
listenTo(
  'id=1', 
  ref.orderByChild('user/id').equalTo(1)
);
listenTo(
  'absence of a nested prop', 
  ref.orderByChild('user/name').equalTo(null)
);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
pufpro
0viewers