Ionic 3 Search from PouchDB or CouchDB


#1

Hi,

I need to connect Ionic3 to PouchDB/CouchDB database and will perform the searching from that database in Ionic frontend.

What’s the best way to achieve this?

Any help mostly appreciated with thanks.


#2

I have created the CouchDB and the source is :

{"total_rows":1,"offset":0,"rows":[
{"id":"2c61dbf0f61185662f8d7d18950006a7","key":"2c61dbf0f61185662f8d7d18950006a7","value":{"rev":"4-4346713f016a555b66960836e5c2830c"},"doc":{"_id":"2c61dbf0f61185662f8d7d18950006a7","_rev":"4-4346713f016a555b66960836e5c2830c","Name":"One, Two, Three","Descrption":"Test1, Test2, Test3","Location":"top, middle, bottom"}}
]}

Here I need to connect the DB and need to perform ionic search from Name

How can I achieve this?


#3

See: https://pouchdb.com/guides/


#4

I already referred this. Please read my question in detail


#5

you can use find function to get specipic document from pouch db


  this.localDb.find({
        selector: {"tbl":"user"}
      }).then((result) => {
        // console.log(result);
        if (result != null) {
          resolve(result.docs);
        }
        else {
          resolve();
        }
      });

#6

you have to install this plugin to use find for couch db

import findPlugin from "pouchdb-find";
PouchDB.plugin(findPlugin);

#7

Hi let me know how to connect pouch or couch db and find the table with example?