title: What is good way to store big JSON objects in couchDb?
body: <p>I work on a web app which store projects data. Data are saved in a couchDb database A. The app pull and push data with a local pouchDb database B, which is sync with A.</p>
  
  <p>So the app can also work offline. When user has connection back, changes made on localDb B during offline time are sent to A using a classic replication.</p>
  
  <p><strong>I store 1 document per project in couchDb</strong>, it is a big JSON object with lot of data (project todos, collaborators, advancements, risks, problems, etc...).</p>
  
  <p>It is working like a charm, but I have some problems, and it seems I use pouchDb in wrong way. Situation example:</p>
  
  <p>User A is offline and he adds a todo on project 1.</p>
  
  <p>User B is online and he adds a new collaborator on project 1.</p>
  
  <p>User B changes are pushed to couchDb by the automatic sync.</p>
  
  <p>The project 1 _rev has been incremented.</p>
  
  <p>User B pulls its own changes from couchDb, because the app downloads all documents on any couchDb changes detected. Weird... Idk how to prevent that. But the app still work fine so it's not a big problem.</p>
  
  <p>User A gets its connection back.</p>
  
  <p>User A changes are ignored because of older _rev. But the user did a modification on a different project property, can couchDb detect that himself and merge with newer _rev ?</p>
  
  <p>I clearly see my problem is I'm using 1 document per project. I could use thousands documents to store each properties of each project and my problem woudn't happens, but it seems quite weird: To retrieve all data of a project I would fully scan my database, check document type (collaborator, todos, ...?), and check if the document is linked to the project by adding a new _projectId property to any document.</p>
  
  <p>Currently I just have to request one document, which contains all project data, then I manipulate my JSON easily. It's quite convenient to handle.</p>
  
  <p>How to manage this ? A project may contains averagely 10 to 10 000 properties that multiple users can edit being online or offline.</p>