mardi 18 juillet 2017

auto_compaction with ember-pouch

I want to use ember-pouch in an electron-app. I just need a local indexedDb without a CouchDB backend. When I use the database-constructor with the argument auto_compaction to true the database is not working as I expect it to. I would expect that every write operation in the localDb triggers a compact() operation. This would wipe out every document with a _delete flag on it. But that doesn't happen The database still holds deleted documents.

My application adapter in ember:

import { Adapter } from 'ember-pouch';
import PouchDB from 'pouchdb';
import config from 'em-trispo/config/environment';
import Ember from 'ember';

function createDb() {
  let localDb = config.emberPouch.localDb;
  let db = new PouchDB(localDb, {auto_compaction: true});
  return db;
}

export default Adapter.extend({
  init() {
    this._super(...arguments);
    this.set('db', createDb());
  }
});




Aucun commentaire:

Enregistrer un commentaire