db.find returns empty array when using with relational-pouch

124 views Asked by At

I changed my queries to relational-pouch but now when i use pouchdb-find it returns an empty array. My code looks like this:

this.$db.createIndex({ index: { fields: ['name', 'code'] } });

this.$db.find({
  selector: {
    _id: { $gte: null },
    name: name,
  },
});

When i save with db.put() it works normally.

1

There are 1 answers

0
Martin Bramwell On BEST ANSWER

My way of getting started with PouchDB was:

  • 1/ Get replication/sync going with CouchDB
  • 2/ Examine all created records with Fauxton
  • 3/ Get ´indexing´ and ´find´ working
  • 4/ Experiment with other tools, such as ´relational pouch´

The advantage of that is you get a clear view into the data records created. It was only after working in that way that I realized that ´relational pouch´ stores everything it wants to manage in an attribute of the stored record called ´data´.

Is it possible that your ´ find ´ ´selector ´ should be ´data.name: name´?