I have an IDB with the following structure :
id: 1
name: "test"
operations: [
{
column: "active"
operator: "="
value: true
}
]
Here the ID is added like so :
request.onupgradeneeded = e => {
let db = e.target.result
db.createObjectStore('filters', { autoIncrement : true, keyPath: 'id'})
}
Users can either add a new record, in which case it will have id: 2 and so on, or add an operation to an existing record.
What should I do to add an auto incrementing key to each operations ?
Expected result :
id: 1
name: "test"
operations: [
{
id: 1
column: "active"
operator: "="
value: true
},
{
id: 2
column: "age"
operator: ">"
value: 32
},
]