在 dexie.js 中,如何从表中获取所有记录?

Lon*_*ike 2 javascript dexie

在 dexie.js 中,有没有办法从表中获取所有记录?

目前我正在使用:

dbTable.filter(() => true).then( ... )
Run Code Online (Sandbox Code Playgroud)

它有效,但我不确定它是否正确。

小智 7

你可以试试这个

const all = await db.friends.toArray()
Run Code Online (Sandbox Code Playgroud)


Dav*_*der 6

db.table("tableName").toArray().then( ... )
Run Code Online (Sandbox Code Playgroud)