Can't add new data in the database once already created the database?
Closed this issue · 1 comments
penguib commented
Hi,
I am trying to add more data to the database after I already made it, and want the default value to be in every player's data.
db.ensure(key, {
money: 0,
level: 0,
inv: [],
items: [],
health: 100
})
The data of money
through items
were the initial data I was keeping track of, but now I want to add health as well. When I add health in the data doesn't go into the player's database when db.ensure is called
.
eslachance commented
If you have new keys added to an ensure() statement, you will need to add the ensureProps: true
options when defining your enmap. For example:
const db = new Enmap({ name: 'money', ensureProps: true });
This will add any missing elements when using ensure().