Add new key value pair to existing database
chk06 opened this issue · 1 comments
chk06 commented
Hi,
I have my DB as below.
{
user: [],
address: []
}
All I want to do is add one new key value pair to the existing database as below.
{
user: [],
address: [],
phone: []
}
I can add a new key value pair under user/address but how can I have it on the same level as user/address?
typicode commented
Hi,
db.data
is a plain JS object, so adding a new key is just like adding a key to an object :)
db.data.phone = []
db.data.phone.push('111-...')
db.write()