couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Gable <zi...@ignition-project.com>
Subject Re: Schema Design when migrating data from relational into document
Date Mon, 09 Apr 2012 14:01:39 GMT
I'd go the first route, but salaries and titles should be arrays of hashes:

"titles": [
{ "name": "xxx", "from": "xxx", "to": "xxx" }
]

If you want to decouple the data, like if you wanted a list of all titles,
you'd use CouchDB views.
On Apr 9, 2012 6:07 AM, "Mohammad Prabowo" <rizalp@gmail.com> wrote:

> Hi, suppose i have relational db with schema like this
>
> employees-schema<
> http://dev.mysql.com/doc/employee/en/images/employees-schema.png>
>
> I want to try converting it into document. I have two question:
>
>   1. The main strength of Document is that it is 'self contained'. Meaning
>   we don't need to do JOIN stuff, and all data that is needed are contained
>   within documents. So, should i choose to use nested documents like this :
>
>   {
>       "emp_no": "...",
>       "birth_date": "...",
>       "first_name": "..",
>       "last_name": "..",
>       "gender": "..",
>       "hire_date": "..",
>       "titles": {
>           "title": "...",
>           "from_date": "...",
>           "to_date": "..."
>       },
>       "salaries": {
>           "salary": "...",
>           "from_date": "...",
>           "to_date": "..."
>       }
>   }
>
>
>   or using different documents like this :
>
>   [
>       {
>           "doc_name": "employees",
>           "emp_no": "...",
>           "birth_date": "...",
>           "first_name": "..",
>           "last_name": "..",
>           "gender": "..",
>           "hire_date": ".."
>       },
>       {
>           "doc_name": "titles",
>           "from_date": "...",
>           "to_date": "..."
>       },
>       {
>           "doc_name": "salaries",
>           "salary": "...",
>           "from_date": "...",
>           "to_date": "..."
>       }
>   ]
>
>
>   2. I want to benchmark MySQL and CouchDB with
> YCSB<https://github.com/brianfrankcooper/YCSB/wiki>.
>   Is there are db layer that has been built for CouchDB ?
>
> Thanks in advance
>

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