title: How to create an index on a child property of an array object in Firebase
body: <p>In my firebase app I am storing objects in an array structure using the push() method that generates unique ids. These objects have a child property called "scheduledDate" How can I create an indexOn rule in firebase to index this field. under events each user has a node, than a child array of their events. /events/userId/arrayOfEvents</p>
  
  <p>I can use orderByChild() to successfully retrieve the records by event scheduled date, but its warning me about the index.</p>
  
  <p>My rules looks like this:</p>
  
  <pre><code>   "events":{
        ".read" : "auth != null",
        ".write" : "auth != null",
        ".indexOn": ["scheduledDate"]
      } 
  </code></pre>
  
  <p>My code doing the query looks like this:</p>
  
  <pre><code>         this.dbEvents = new Firebase(firebaseEventsUrl);
  
           var q;
  
           q = this.dbEvents.child(userId).orderByChild("scheduledDate").limitToLast(limitToLast);
  
           return $firebaseArray(q);
  </code></pre>
  
  <p>My data looks like this:</p>
  
  <pre><code>          events:{
                user1:{
                    -K2NYCT2_uMwsTSfH58O(push generated):{
                        description: 'event 1',
                        scheduledDate: 1446730200000
                    },
                    --K2NyNh660I4k8loar-z:{
                        description: 'event 2',
                        scheduledDate: 1446730200000
                    },
                },
                user2:{
  
                }
            }
  </code></pre>