Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since it is a different technology there are trade-offs. And sometimes although things look like they will take more resources (an extra request) in the short-run it can be inconsequential, and in the long-run may give significant scalability, if you need that sort of thing.</p> <p>CouchDB can handle a lot of different "databases" at the same time, which you can think of as different model spaces. So with the same running instance of CouchDB you could have <code>/users</code> and <code>/posts</code>. This requires absolutely no additional work on the part of configuration or performance of CouchDB.</p> <p>This can make your map code more straight forward as you then don't need to have the 'Schema' field and be incorporating it into every map function.</p> <p>Also, you can (and should) have multiple different map/reduce pairs in a given design view. This is important because if you have two different document "Schema"s <code>emit(doc.id, doc.val)</code> how can you tell which is which for reduce purposes.</p> <p>A more CouchDB idiomatic way to look at your data would be that you don't save the post_ids on the user. Just the UserID on the Posts, then have a map something like the following for Posts:</p> <pre><code>(doc) -&gt; emit([doc.user_id, doc.isFeatured], null); emit([doc.isFeatured, doc.createdAt], doc.user_id); </code></pre> <p>Then a request to the view API with arguments like <code>?start_key=['12345345345234234']&amp;end_key=['12345345345234234',{}]</code> would get all their posts.</p> <p>Where one with <code>?key=['12345345345234234', 1]</code> would just get their featured posts.</p> <p>The second emit also gives you ability to quickly get all of the posts that are featured across the whole system sorted by date -- with who made them if you want that data, without getting the whole of the posts sent down the pipe.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload