Paralife
Paralife

Reputation: 6236

Why isnt there a read analog of validate_doc_update in couchdb?

I am posing it as a suggested feature of couchdb because thats is the best way to express what i would like to achieve, and as a rant because i have not found a good reason for its lack: Why not have a validate_doc_read(doc, userCtx) function so that I can implemen per-document read control? It would work exactly as validate_doc_update works, by throwing an error when you want to deny the read. What am I missing? Has someone found a workaround for per-document read control?

Upvotes: 2

Views: 494

Answers (2)

Claudio Santos
Claudio Santos

Reputation: 1317

The main problem to create a validate_doc_read, is how do we work with reduce functions with that behavior.

I can't believe thar a validate_doc_read is the best solution because we will give away one feature in favour of another.

In this way, you must restrict the view access using a proxy.

Upvotes: 1

smathy
smathy

Reputation: 27971

I'm not sure what the actual reason is, but having read validation would make reads very slow, and view indexes very hard to update incrementally (or perhaps impossible meaning that you'd basically have to have a per-user index).

The way to implement what you want is via filtered replication, so you create a new DB with only the documents you want a given user to be able to read.

Upvotes: 1

Related Questions