Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 577 Bytes

query.md

File metadata and controls

32 lines (26 loc) · 577 Bytes

resources

Indexing

For queryByChild

{
  "rules": {
    "appointments": {
      "$userId": {
         ".indexOn": ["date"]
      }
    }
  }
}

filtering

var userId = 'HeFltOAjsgRrXFYZB3g2Ref33oN2';
var ref = firebase.database().ref('appointments/' + userId);
ref.orderByChild('date').equalTo('07/09/2016').once('value', function(snapshot) {
  console.log(snapshot.key);
  snapshot.forEach(function (data) {
    console.log(data.val());
  })
});