📜  array lowdb - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:12.634000             🧑  作者: Mango

代码示例1
// Get your user
let inventory = db
    .get('users')
    .find({ id: '272659147974115328' })
    .get('inventory')
    .value();

// Do something to your user's inventory
inventory.push({ itemID: '9999999', rarity: 'common' });

// Update the user with the modified inventory

db.get('users')
    .find({ id: '272659147974115328' })
    .assign({ inventory })
    .write();