incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabor Ratky <rg...@rgabostyle.com>
Subject Re: Remove field from view
Date Tue, 16 Aug 2011 13:23:02 GMT
You're not thinking about it in the wrong way. Keeping document sizes low is crucial for views
to perform in an acceptable manner (documents 500kb-1mb will get the view indexer into a screeching
halt because of the JSON encoding/decoding overhead).

Our solution to a very similar problem was having a separate database (without views, although
this was just a side-effect) with the exact same document IDs containing this large data.
This way it won't affect your usual scenarios but you can retrieve it from the other DB when
needed. Of course, this separation has to happen when creating the documents or as a separate
process afterwards that you will need to code manually, although you could use something like
https://github.com/maxogden/recline or kanso.js document transformation, but IMHO these are
not the right tools for your particular problem.

HTH,
Gabor


On Tuesday, August 16, 2011 at 2:32 PM, Antoine Kurukchi wrote:

> I might be thinking of this in the wrong way.
> 
> I already have the doc and rev id. I'm trying to get the doc without c as c
> has quite a lot of data. Which isnt required till much later and even then
> only a few will be needed.
> 
> The whole database without c is about 25mb. With c its 2 gb.
> 
> I dont want to seperate c from the other data.
> 
> Any thoughts?
> 
> On Aug 16, 2011 1:21 PM, "Gabor Ratky" <rgabo@rgabostyle.com (mailto:rgabo@rgabostyle.com)>
wrote:
> > 
> > A view, as its name implies is a read-only view of the underlying data.
> You can omit emitting `c` in the view, but all that will mean that it will
> not be included in the view itself (either as its key or its value), but it
> will still exist in the underlying documents.
> > 
> > You could potentially emit the whole document MINUS the `c` field as part
> of the view, but it would result in a huge view, whereas usually you would
> just use `include_docs=true` parameter to query the document itself along
> with the view.
> > 
> > Maybe you could explain what exactly you're trying to achieve in further
> detail?
> > 
> > Gabor
> > 
> > 
> > On Tuesday, August 16, 2011 at 2:13 PM, Antoine Kurukchi wrote:
> > 
> > > Is it possible in a view to remove a field if present and has anyone got
> an
> > > example? I would like to keep all other fields. Also this will be with
> > > different documents.
> > > 
> > > For example my document has 3 fields a,b,c. Another document has
> b,c,d,g. So
> > > I want the view to process both those documents and remove c. Should
> have
> > > the following as the result:
> > > 
> > > a,b and b,d,g
> > > 
> > > Antoine


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