MongoDB queries look simple. You type a field, give it a value, hit run, and you get your data back.
But just because a query runs without throwing an error doesn't mean it worked right. Sometimes you get a blank screen. Sometimes you get way too many records. Other times, the data looks fine at first glance, but it doesn't actually match what you asked for.
Most of these slip-ups happen for one basic reason: the query structure doesn't match the way the data actually sits in the database.
To show you what we mean, we’ll use a clinic database with a collection called visits. Here is what a typical document looks like:
{






