title: Getting nodes from Firebase Database with a complex query in Android Studio
body: <p>I've got a Firebase Realtime Database, with this sample structure
  <a href="https://i.stack.imgur.com/RdrzH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RdrzH.jpg" alt="Basic node structure"></a></p>
  
  <p>I need to create filters, so I can grab all nodes that, i.e., costs between $100 and $400, not farther away than 60 miles from my current location, and whose startDate is not before today. Or any kind of combination of those filters (cost from, cost to, distance, start date from, start date to).</p>
  
  <p>Is there any efficient way of storing this data so all the filtering can occur on the server side?</p>
  
  <p>I know I can make an <code>.orderByChild( "cost" ).startAt(100).endAt(400)</code>, and then iterate through the <code>datasnapshot</code> on the client side, but I don't think it's elegant or efficient when the database grows. </p>
  
  <p>Imagine bringing millions of nodes just to show the 3 or 4 that fulfills all filters.</p>
  
  <p>I've been doing a lot of research (believe me), but it's so hard for me to still grab the taste of it.  I've been raised in a SQL shell, and those querys used to be my ABC, I just can't stand the idea of things getting so annoyingly ugly, but it must be me.</p>
  
  <p>Anyone with more experience with these NO-SQL databases can give me a hand out here?  It has to be Firebase Realtime Database, not the Cloud Firestore.</p>