cradle adapter's "all" with "where" properties inefficient
- Lenguaje dominante
- JavaScript
- Estrellas
- 2k
- Forks
- 238
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I'm looking at [this chunk of code](https://github.com/1602/jugglingdb/blob/master/lib/adapters/cradle.js#L264-L290) 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](https://github.com/cloudhead/cradle/blob/master/lib/cradle/database/documents.js#L95) 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?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.