如何从每一行中仅获取价格
db -
[{
"id": 1,
"name": "name 2",
"price": 40,
"img": "img.jpeg",
"isActive": true
}, {
"id": 2,
"name": "name 2",
"price": 60,
"img": "img.jpeg",
"isActive": true
}]目前,在db.product.toArray()的帮助下,我能够获得所有数据。
但我想从Dexiejs indexedDB那里得到40,60。
发布于 2021-04-12 05:35:12
如果对price进行索引,则可以使用Collection.keys()。
const db = new Dexie('yourDBName');
db.version(2).stores({
product: 'id, price'
});
const prices = await db.product.orderBy('price').keys();https://stackoverflow.com/questions/67044739
复制相似问题