2014-03-28 93 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