incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Black <...@alwaysreformed.com>
Subject Re: Trying to wrap my head around CouchDB
Date Tue, 16 Jul 2013 20:11:17 GMT
Yves,

These pages will help you with these questions:

http://guide.couchdb.org/editions/1/en/views.html
http://guide.couchdb.org/editions/1/en/lists.html
http://guide.couchdb.org/editions/1/en/cookbook.html

More specifically,

On 07/16/2013 02:51 PM, Yves S. Garret wrote:
> 1 - How is data represented in CouchDB as compared to MySQL?  
MySQL lets you define each table's schema in terms of what column names
and types are found in each table, and what indexes optimize searching
what columns in each table.
> How can I
> create (or visualize in
> my head) multiple tuples of the same type of data (as in a table that has
> columns of specific types
> and then each entry is a row)?  If I need to store multiple orders in a
> system (where the data looks
> roughly the same, how would that look?
In CouchDB, there is no schema, so you have more options for how to
structure your data, but a common way to mimic MySQL's tables in CouchDB
is as follows:

Each row of a MySQL table is one JSON document in CouchDB.  Each
document contains a "type" or "collection" (in backbone-couchdb, for
instance) attribute, so one example document could be {"type":"order",
"name":"Honda Accord", "amount":"10,000.00"}.  You could make other
documents which also contain the attribute "type":"order".  All these
"order" documents would be roughly equivalent to a table in MySQL named
"order".

To get all order documents in one request, write, then query, a view
which only emits documents if (doc.type == 'order').
> 2 - How is binary data handled inside of CouchDB?
As attachments to documents.
>   As in, how is data
> stored inside of CouchDB
> and then used (text and binary)?
Attachments can be directly accessed at a URL under the URL for the
document to which they are attached.

Tim


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message