Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db.destroy doesn't work on memdown created with {db: require('memdown')} #3144

Closed
calvinmetcalf opened this issue Dec 9, 2014 · 5 comments
Closed

Comments

@calvinmetcalf
Copy link
Member

No description provided.

@jacargentina
Copy link
Contributor

Just confirming... it is possible that the bug is aplicable to any PouchDB instance using a custom {db: require('...') } options, which are not used on the 'new' pouchdb instance created when destroy is called ?

@calvinmetcalf
Copy link
Member Author

right it's if you pass it in as an option

@jacargentina
Copy link
Contributor

@calvinmetcalf I'have another bug, when using this commit. Maybe u can fix it faster than i can, and kill 2 birds from a single shot :-)

This simply code fails on Node, when using db: { require('sqldown') }

var PouchDB = require('pouchdb');

var pouch = new PouchDB('test.db', {
  db: require('sqldown')
});

pouch.put({
  _id: '_design/test',
  views: {
    test: {
      map: function(doc) {
        return doc;
      }.toString()
    }
  }
}).then(function() {
  pouch.destroy()
    .then(function() {
      console.log('ok ');
    })
    .catch(function(err) {
      console.log('error ', err);
    });
});

I'get the error:

error  { [Error: EBUSY, unlink 'C:\Git\project\test.db']
  errno: 10,
  code: 'EBUSY',
  path: 'C:\\Git\\project\\test.db' }

Maybe the destroy code for other adapters are missing some "close all files" before actually destroying?

@calvinmetcalf
Copy link
Member Author

um I think that is an error in sqldown

@calvinmetcalf
Copy link
Member Author

beb3a6e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants