cradle adapter's "all" with "where" properties inefficient
- Vorherrschende Sprache
- JavaScript
- Sterne
- 2k
- Forks
- 238
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Examine lib/adapters/cradle.js lines 264-290 to understand the current view creation and filtering logic. Review Cradle's save API and caching behavior. Investigate how other adapters or libraries like resourceful handle view caching and dynamic view creation for 'where' queries. Determine if permanent CouchDB views can be created dynamically for common query patterns.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, nodejs
- Bereich
- backend, database
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100