langalex / couch_potato

Ruby persistence layer for CouchDB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic conditions in views

aL3xa opened this issue · comments

Sorry for n00bish question, but I'd like to pass dynamic values to views via view definition in model. Something like:

view :completed, :key => :name, :conditions => "doc.completed === #{var}"

Is it at all possible, or should I stick with filters I wrote in JS?

Well, if you mean dynamic as in at query time then no, that's impossible with CouchDB. The conditions must be set at "compile time".

Yeah, silly me. Sry for bugging you.