title: MongoDB: aggregation with redact with $in fails
body: <p>I've got the following two <code>Objects</code> in a mongo collection named <code>cars</code>:</p>
  
  <pre><code>{vendor: "BMW",
  model: "325i",
  class: "coupe",
  equipment: [
      {name: "airbag",
       cost: 120
      },
      {name: "led",
       cost: 170
      },
      {name: "abs",
       cost: 150
      }
   ]
  }
  
  {vendor: "Mercedes",
  model: "C 250",
  class: "coupe",
  equipment: [
      {name: "airbag",
       cost: 180
      },
      {name: "esp",
       cost: 170
      },
      {name: "led",
       cost: 120
      }
   ]
  }
  </code></pre>
  
  <p>I'm playing around with the new aggregation feature <a href="http://docs.mongodb.org/manual/reference/operator/aggregation/redact/#pipe._S_redact" rel="noreferrer">redact</a> introduced in Mongo 2.6
  I want to perform a query to get a list of cars with filtered equipment parts.
  In words: Give me all cars of type coupe and only the information about <code>LED</code> and <code>AIRBAG</code> equipment.</p>
  
  <p>I've tried this aggregations:</p>
  
  <pre><code>db.cars.aggregate(
      [
          {$match: {"class": "coupe"}},
          {$redact:
          {
              $cond:
              {
                  if: { $in : ["$name", ["airbag", "led"]]},
                  then: "$$DESCEND",
                  else: "$$PRUNE"
              }
          }
          }
      ]
  )
  </code></pre>
  
  <p>But that leads to following error:</p>
  
  <blockquote>
    <p>assert: command failed: { "errmsg" : "exception: invalid operator
    '$in'", "code" : 15999, "ok" : 0 } : aggregate failed</p>
  </blockquote>
  
  <p>What I'm doing wrong? Is there another way to achieve the goal.</p>
  
  <p>I would expect to get back this result from Mongo:</p>
  
  <pre><code>{vendor: "BMW",
  model: "325i",
  class: "coupe",
  equipment: [
      {name: "airbag",
       cost: 120
      },
      {name: "led",
       cost: 170
      }
   ]
  }
  
  {vendor: "Mercedes",
  model: "C 250",
  class: "coupe",
  equipment: [
      {name: "airbag",
       cost: 180
      },
      {name: "led",
       cost: 120
      }
   ]
  }
  </code></pre>
  
  <p>Any suggestions on how to achieve this?</p>
  
  <p>Cheers,
  Ralf</p>