Using design documents in pouchDB with crypto-pouch

After testing pouchDB for my Ionic project, I tried to encrypt my data with crypto-pouch. But I have a problem with using design documents. I used the following code:

One of my design documents:

var allTypeOne = {
  _id: '_design/all_TypeOne',
  views: {
    'alle_TypeOne': {
      map: function (doc) {
        if (doc.type === 'type_one') {
          emit(doc._id);
        }
      }.toString()
    }
  }
};

For init my database:

function initDB() {
  _db = new PouchDB('myDatabase', {adapter: 'websql'});
  if (!_db.adapter) {
    _db = new PouchDB('myDatabase');
  }
  return _db.crypto(password)
    .then(function(){
      return _db;
    });
  // add a design document
  _db.put(allTypeOne).then(function (info) {
  }).catch(function (err) {
  }
}

To get all documents of type_one:

function getAllData {
  if (!_data) {
    return $q.when(_db.query('all_TypeOne', { include_docs: true}))
      .then(function(docs) {
        _data = docs.rows.map(function(row) {
          return row.doc;
        });
    _db.changes({ live: true, since: 'now', include_docs: true})
      .on('change', onDatabaseChange);
      return _data;
    });
  } else {
    return $q.when(_data);
  }
}

This code works without using crypto-pouch well, but if I insert the _db.crypto(…) no data is shown in my list. Can anyone help me? Thanks in advance!

I have been recently working w/ this pouch plugin as well. I was having similar problems until I destroyed the db and started over. In my model, I have a set of (3) design docs for (3) data types that return data. And, I have a CouchDB server that I run replication/sync against. Once I destroyed the local db and started over, the issues went away. Upon recreating and syncing the local db w/ crypto “ON”, the design docs (and all data docs) were appropriately encrypted and the views from the design docs began working.

-Jeff