incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Ivasyuv <indust...@gmail.com>
Subject Re: CouchDB namespace mechanism
Date Wed, 20 Oct 2010 09:35:10 GMT
On 10/19/2010 09:08 PM, Dave Cottlehuber wrote:
> On 20 October 2010 01:42, Alex Ivasyuv<industral@gmail.com>  wrote:
>    
>> Hi,
>>
>> I faced an issue, with different types of documents in CouchDB.
>> For example, I have 3 types of doc in DB:
>>
>> list-1
>> list-2
>> list-3
>>
>> tag-1
>> tag-2
>> tag-3
>>
>> user-1
>> user-2
>> user-3
>>
>> And issue for me, that they are lie in one layer, e.g.
>> http://localhost:5984/mydb/<here all docs>
>>
>> Is there any mechanism to decoupled them into different layers, e.g.
>> namespace or something else:
>>
>> {user: [user-1: {...}]}
>> {lists: [list-1, list-2, ...]}
>>
>> where user and list - namespaces for documents.
>>
>> Seems like I wrong understood the paradigm of NoSQL and CouchDB as instance.
>>
>> Thanks in advance,
>>
>>      
> Hi Alex
>
> A common example is to use a doc.type field in each doc; here I have
> locations&  contacts in the same DB;
>
> {
>      "_id": "DEU.Berlin",
>      "type": "location",
>      "country": "DEU",
>      "city": "Berlin",
>      "address": "Speedbone Internet&  Connectivity GmbH\nAlboin
> Kontor\nAlboinstr. 36-42\n12103 Berlin"
> }
>
> {
>      "_id": "dave@example.org",
>      "type": "contact",
>      "location": "NZL.Wellington",
>      "phone": "+64 4 9727208",
>      "fax": "+64 4 9727123",
>      "name": "Dave Cottlehuber"
> }
>
> and then they can be filtered/split separately in views with a map/reduce;
>
> function(doc) {
>    if (doc.type == "location") {
>      emit(doc.location, doc.type ) }
> };
>
> http://guide.couchdb.org/draft/lists.html
>
> cheers
> Dave
>    
Hi Dave,

Thanks for example. Right now I use this approach.
I just thought that there's exist some advanced way to do this.


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