jugglingdb icon indicating copy to clipboard operation
jugglingdb copied to clipboard

cradle adapter's "all" with "where" properties inefficient

Open jfhbrook opened this issue 11 years ago • 3 comments

I'm looking at this chunk of code in the cradle adapter. I have a few questions.

First: Won't this recreate the view every time you call it? I know cradle has caching but having looked at cradle's save api it doesn't appear that caching stops cradle from pushing views. Perhaps this should use an approach similar to Nodejitsu's resourceful, where views are cached locally and only created when they change?

Second: Is there a better way to handle views for "where" properties? The way I see it, this loads all the documents of a certain type into memory and then runs a filter against them. Shouldn't we be pushing this to couch views? One suggestion is to dynamically create permanent couchdb views when there are "where" properties, which should work as long as there are a finite amount of these sorts of queries.

Is there another way to approach this problem in jugglingdb? Am I missing something?

jfhbrook avatar May 21 '13 23:05 jfhbrook