eFishery / pouchy-store

Libraries to ease pouch-couch stack on offline first app
MIT License
12 stars 3 forks source link

new feature View #9

Open ajiagahari opened 4 years ago

ajiagahari commented 4 years ago

as mention here : https://docs.couchdb.org/en/stable/ddocs/views/pagination.html#example-data

couchdb has a view feature, so I wanna add new override method view in constructure, if it used then it will get view data only, because not every store use view

ans-4175 commented 4 years ago

Hey @ajiagahari could you please elaborate your method or approach? This view , would affect in memory data or what structure?

ajiagahari commented 4 years ago

this is the method I use in couchdb, using the design db feature in fauxton,

{
 "id": "_design/leads",
 "key": "_design/leads",
 "value": {
  "rev": "3-5939044487ce9417e15fc976e0451911"
 },
 "doc": {
  "_id": "_design/leads",
  "_rev": "3-5939044487ce9417e15fc976e0451911",
  "views": {
   "view-leads": {
    "map": "function (doc) {\n  if(doc.deletedAt === null || doc.deletedAt === ''){\n    emit(doc._id, doc);\n  }\n}"
   }
  },
  "language": "javascript"
 }
}

it created 1 row in all document so pouchy store always gets it, and it make sorting or others javascript object manipulation get messy, thats why I wanna propose override methode to handle this view, if not used it will use default config