Mixing MongoDB query types (and, or)
I am using MongoDB to store information on coffees and I am having problems with a query.

My document structure is:

    { _id: "Thailand Bok", tags: ["Strong", "Smooth", "Dark"] }

I am trying to create query that allows me to search either on the name or tags.

So given that a query string may be "Thailand Bok" or ["Strong", "Smooth"] I want to search for requests that either contain the _id or each tag. 

If I were thinking in SQL terms it may be something like this:

    "WHERE `_id` like 'Thailand%' OR ("Strong" IN `tags` AND "Smooth" IN `tags`)"

The query I have so far is:

    $or: {
      { _id: { $regex: '^Thailand', '$options': 'i' } },
      { 
          '$and': [ 
              { tags: 'Strong' }, 
              { tags: 'Smooth } 
          ]
      }
    }


Mixing MongoDB query types (and, or)
===

I am using MongoDB to store information on coffees and I am having problems with a query.

My document structure is:

    { _id: "Thailand Bok", tags: ["Strong", "Smooth", "Dark"] }

I am trying to create query that allows me to search either on the name or tags.

So given that a query string may be "Thailand Bok" or ["Strong", "Smooth"] I want to search for requests that either contain the _id or each tag. 

If I were thinking in SQL terms it may be something like this:

    "WHERE `_id` like 'Thailand%' OR ("Strong" IN `tags` AND "Smooth" IN `tags`)"

The query I have so far is:

    $or: {
      { _id: { $regex: '^Thailand', '$options': 'i' } },
      { 
          '$and': [ 
              { tags: 'Strong' }, 
              { tags: 'Smooth } 
          ]
      }
    }

