title: NoSQL databases in offline mode and forward compatibility
body: <p>After doing some research, it seems that when people ask about schema migration in CouchDB, they get quickly rebutted that the concept is not exactly compatible with NoSQL ideology. I understand how NoSQL is meant to be schema-less and it feels counter-intuitive. Nevertheless, I am in such a situation that I do not see how schema migration can be totally avoided. I use NoSQL with mobile devices. Here's the big lines of my set-up and my needs.</p>
  
  <ol>
  <li>Each mobile device has its own replicated database.</li>
  <li>The mobile device can work offline.</li>
  <li>Mobile devices replicates with a database on the cloud server to share their data.</li>
  <li>The data replicates when possible so multiple users on different devices can work on the same data.</li>
  <li>A newer version of the client could decide to change the value type it stores for a particular key (i.e. the equivalent of a schema change)</li>
  <li>The users might not update the app as soon as an update is available.</li>
  <li>A user that is not updated should be able to still work on the same data as the users who are updated.</li>
  </ol>
  
  <p>Edit:</p>
  
  <ol>
  <li>The application is 100% native code.</li>
  </ol>
  
  <p>My problem here is that a user with a client that is an old version of the software would not expect the new data to be a string instead of an int per se. Thus, handling it client-side can not always be done since we do not want to force the users to update their apps.</p>
  
  <p>To explain it under another angle what happens is that I want two users with two different client versions to be able to share and modify the same data, meaning that I need to have backward and forward compatibility. Backward compatibility is often tackled, but forward compatibility is a bit more problematic. I need a way to continue to use my last-modified heuristic for conflict resolution while having a version that can not interpret the new schema fully. </p>
  
  <p>After some thinking, I could consider an approach where I should split the cloud database into multiple sources; one where every mobile device pushes its modifications and one-to-x databases where the mobile devices pull the most recent data adapted to their versions. Somewhere in between those I should handle backward and forward compatibility with schema migrations. </p>
  
  <p>Is there a way to avoid schema migrations, even in such a set-up?
  Do anyone see any other simpler or safer solutions? 
  What are the limitations of such a system? 
  I do not feel that I am exactly on the right track here.</p>
  
  <p>Thanks,
  Paul</p>