title: Converting some fields in Mongo from String to Array
body: <p>I have a collection of documents where a "tags" field was switched over from being a space separated list of tags to an array of individual tags. I want to update the previous space-separated fields to all be arrays like the new incoming data. </p>
  
  <p>I'm also having problems with the $type selector because it is applying the type operation to individual array elements, which are strings. So filtering by type just returns everything. </p>
  
  <p>How can I get every document that looks like the first example into the format for the second example?</p>
  
  <pre><code>{
      "_id" : ObjectId("12345"),
      "tags" : "red blue green white"
  }
  {
      "_id" : ObjectId("54321"),
      "tags" : [
          "red",
          "orange",
          "black"
      ]
  }
  </code></pre>