couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Rakotojaona <matthieu.rakotoja...@gmail.com>
Subject Re: copying a document with some fields removed
Date Tue, 12 Jun 2012 08:53:38 GMT
On Tue, Jun 12, 2012 at 1:29 AM, bryan rasmussen
<rasmussen.bryan@gmail.com> wrote:
> I have a public view which basically should return everything in an
> document except for the username field.
>
> Does couchdb have some sort of higher level way of doing this that
> will have better performance than just looping through the object and
> copying over every property unless it is the username one?

You mean something like the _list [0] ? Basically, you will iterate
over the rows of your view, which all contain the relevant doc
(remember : do not store the doc in the view, retrieve it only at GET
time), already serialized into JSON. You can then safely delete the
`username` property without looping through it.

But it looks like you want some kind of privacy for your docs. Your
view/list might hide the `username` in the doc, but the docs will
still be readable by the same user who can read the view. As the
security is managed on a database-wide level, you will have to do some
miking with another database. If this is the case, there is something
you can do, but it will eat a big part of your HDD (but it's CouchDB,
after all :)

[0] http://wiki.apache.org/couchdb/Formatting_with_Show_and_List


-- 
Matthieu RAKOTOJAONA

Mime
View raw message