title: How to query Firebase by attribute of a child?
body: <p>Schema:</p>
  
  <p><a href="https://i.stack.imgur.com/LFmnM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LFmnM.png" alt="Schema:"></a></p>
  
  <p>I'm trying to get all the objects filter by owner</p>
  
  <p>To get a specific I do this:</p>
  
  <pre><code>var refCompaniesById = firebase.database().ref('companies').child(id);
  </code></pre>
  
  <p>But in this case I wanted to filter all</p>
  
  <p>I tried:</p>
  
  <pre><code>ref.child('companies').child().set({"owner": id})
  </code></pre>
  
  <p>But I failed.</p>