I have a a bunch of keys that i want to index using .indexOn
Suppose my data looks like the following.  I want to be able to use .orderByChild("height").
{
  "lambeosaurus": {
    "stats": {
      "height" : 2.1,
      "length" : 12.5,
      "weight": 5000
    }
  },
  "stegosaurus": {
    "stats": {
      "height" : 4,
      "length" : 9,
      "weight" : 2500
    }
  }
}
How wound I specify the rule for indexing height which is a child of stats?  Do I have to restructure or flatten my data?
Cloud Firestore uses two types of indexes: single-field and composite.
Once the push method has created a new child, it returns a DatabaseReference object initialized with the path to that child. Calling the getKey() method on this reference will return the auto-generated key which may then be used to store a corresponding value.
This chat application allows users to store the basic profile and contact list. The user profile would be located on a path such as Users/$uid. User is a node in it and will have a sort of primary key associated with an ID. So, we can access each one uniquely.
You can query and index arbitrarily deep now.
{
  "rules": {
    "$dinosaur": {
      ".indexOn": ["stats/height"]
    }   
  }
}
and query on nested values:
.orderByChild('stats/height')
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With