title: Using Firebase, how can I create a query based on UID?
body: <p>I created a function that adds a UID to the database along with an item's state:</p>
  
  <pre><code>changestate(item) {
  
      var postData = {
        state: "listed",
      };
  
      var user = firebase.auth().currentUser;
      var uid = user.uid;
  
      var updates = {};
      updates['foods' + '/' + item.$key + '/' + 'state' + '/' + uid] = postData;
  
      return firebase.database().ref().update(updates);
    }
  </code></pre>
  
  <p>I want to create a query that only shows the data corresponding to that UID. In a previous query I was using:</p>
  
  <pre><code>getLists(): FirebaseListObservable&lt;any&gt; {
  return this.db.list('/foods', {
    query: {
      orderByChild: 'state',
      equalTo: 'listed'
    }
  });}
  </code></pre>
  
  <p>This is the structure of my database:</p>
  
  <pre><code>{
    "foods" : {
      "foodID1" : {
        "category" : "Produce",
        "foodname" : "Apples",
        "state" : {
          "aePQkvozV6gehP7ihjN0OWCltKu2" : {
            "state" : "listed"
          }
        }
      },
      "foodID2" : {
        "category" : "Dairy",
        "foodname" : "Cheese",
        "state" : {
          "aePQkvozV6gehP7ihjN0OWCltKu2" : {
            "state" : "listed"
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>What do I need to do to show the items that correspond to a signed in user's UID?</p>