incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Black <...@alwaysreformed.com>
Subject Re: couchdb data structure
Date Wed, 20 Nov 2013 19:22:09 GMT
John,

On 11/19/2013 04:28 AM, John Norris wrote:
> I am trying to retrofit an existing web app using SQL to couchdb with
> ektorp. I have setup couchdb and run through some tutorials (ektorp,
> seven databases in seven weeks, definitive guide).
> If I have several objects (represented as pojos) then in SQL this
> would probably equate to several tables within the database.
> But in couchdb, a database is a number of documents? And those
> documents can represent several object types? So do I need each
> document to have a field representing what type it is? (eg a field
> that is unique to that document type).
So far as I can understand your question, it depends on whether each
pojo object contains many rows of similar data.  If they don't then
represent each object as one doc, like this:

{ _id:"12345", type:"pojo" }

> Or does each document type go in its own database?
If each pojo object contains many rows of similar data, I'd probably
break it up into one document per row and keep all the pojos in the same
database, so I could query across all pojos.  I don't think it's
possible to query across multiple databases in CouchDB.

Tim


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