title: Data Migrating document for Couchbase (i.e changing existing field type)?
body: <p>I am coming from object relation database background, I understand Couchbase is schema-less, but data migration will still happen as the application develop.</p>
  
  <p>In SQL we have management tool to alter table, or I can write migration script with SQL to do migration from version 1 table to version 2 table.</p>
  
  <p>But in document, say we have json Document UserProfile:</p>
  
  <pre><code>UserProfile
  {
    "Owner": "Rich guy!",
    "Car": "Cool car"
  }
  </code></pre>
  
  <p>We might want to add a last visit field there, allow user have multiple car, so the new updated document will become follows:</p>
  
  <pre><code>UserProfile
  {
    "Owner": "Rich guy!",
    "Car": ["Cool car", "Another car"],
    "LastVisit": "2015-09-29"
  }
  </code></pre>
  
  <p>But for easier maintenance, I want all other UserProfile documents to follow the same format, having "Car" field as an array.</p>
  
  <p>From my experience in SQL, I could write migration script which support migrating different version of table.  Migrate from version 1 table to version 2...N table.</p>
  
  <p>So how can I should I write such migration code?  I will have to really just writing an app (executable) using Couchbase SDK to migrate all the documents each time?</p>
  
  <p>What will be the good way for doing migration like this?</p>