4
檢索值使用PouchDB我試圖db.getAll()
檢索所有文件和db.get()
單文件,但沒有一個對象返回包含我插入值插入數據後。無法從PouchDB
我在做什麼錯?你已經完成了之前的數據插入到PouchDB,由於是IndexedDB API的所有數據庫查詢都是異步
new Pouch('idb://test', function(err, db) {
doc = {
test : 'foo',
value : 'bar'
}
db.post(doc, function(err, data) {
if (err) console.error(err)
else console.log(data)
})
db.allDocs(function(err, data) {
if (err) console.error(err)
else console.log(data)
})
})
與我的代碼完全相同的輸出 – andrei 2012-04-24 14:43:14
明白!是的異步部分造成它。謝謝:) – andrei 2012-04-24 15:02:51