jugglingdb icon indicating copy to clipboard operation
jugglingdb copied to clipboard

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

Open jfhbrook opened this issue 12 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

+1

Marak avatar May 22 '13 23:05 Marak

Let's forward these questions to author of this adapter: @athieriot.

1602 avatar May 23 '13 10:05 1602

Hi.

To be honest. It's been a while seens I pushed this code and I don't work on the project which use it anymore. So I unfortunately can't answer accurately to your questions :(

However, if I'm not sure about your first point, there is definitively improvement to make at the "where" statement. You seem to know CouchDB very well. Feel free to try something :)

Thank you for your interest.

Aurélien

athieriot avatar May 23 '13 10:05 athieriot