2014-03-28 94 views
0

我无法删除我的PouchDB来重置我的jQuery Mobile应用程序。无法销毁PouchDB

(等效的jsfiddle:http://jsfiddle.net/bYR8c/2/

我在app.js

var db = new PouchDB('petrolog'); 

function resetDb(){ 
    db.destroy(function(err, info) { console.log('Error: ' + err); 
     console.log('Info: ' + info); }); //this is line 38, referenced in errors below 
    showFillups(); //redraws the UI 
} 

index.html

<head> 
<script src="http://download.pouchdb.com/pouchdb-nightly.js"></script> 
</head> 

<body> 
<a id="btnResetDb" class="ui-shadow ui-btn ui-corner-all">Erase all fillups</a> 

<script> $('#btnResetDb').click(function(event){resetDb();}); </script> 
</body> 

当我按一下按钮,我从萤火如下:

Error: null  app.js (line 38) 
Info: undefined app.js (line 38) 

这些符合我的resetDb()

任何建议db.destroy()指令?我已经在http://pouchdb.com/api.html#delete_database上检查过API文档,但在那里找不到太多帮助。

回答

1

destroy()方法实际上不会为info返回任何内容。 error为空的事实表明一切都成功了。

这实际上是PouchDB文档中的一个错误,我们将解决它。

但是,您的jsfiddle不起作用,因为不相关的原因:小提琴环境似乎无法访问任何本地数据库,因此在Firefox中我看到Error: No valid adapter found

+0

只是一个简单的问题:它说摧毁被摧毁了,所以我应该只标记所有被删除的entrys/documents,然后压缩这个东西? – user2741831

+0

'destroy()'是一个与压缩不同的操作,它是'PouchDB.destroy()',不推荐使用'db.destroy()'。我会更新文档以使其更清晰。 – nlawson