Answer the question
In order to leave comments, you need to log in
How to assign an incremental id for each new item?
Suppose
there is a store
When a person buys an item in it, an item is added to his inventory:
(only these items are dynamic, they will often be removed from the inventory or new ones will be added)
{
id: 1//и тут должен быть auto-increment
itemid: 251//id именно предмета
added_at: Date.now()
}
{
id: 21, //тут тоже auto-increment но с ним проблем нет
balance: 0,
name: 'kek',
avatar: 'avatar'
items: []// и тут хранятся предметы которые пользователь покупает. И как то для них надо сделать auto-increment и я не знаю как
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question