localbase icon indicating copy to clipboard operation
localbase copied to clipboard

How can we make the key auto incremented ?

Open KiranUppunda opened this issue 3 years ago • 3 comments

Is it possible to make the key auto incremented on each insert ?

KiranUppunda avatar Nov 24 '20 06:11 KiranUppunda

I was just going to ask this exact same question!

CynthiaBlue avatar Dec 22 '20 21:12 CynthiaBlue

I was just going to ask this exact same question!

BL2011 avatar Oct 26 '21 06:10 BL2011

I have a requirement for this too.

As a workaround you can do:

if (!key) key=String(await this.$db.collection(table).get().length)
await this.$db.collection(table).add(iValue, key)

Possible solution await this.$db.collection(table).add(value) // Automaticly incrementing the key starting from 0 (replacing the generated key) resulting in image instead of image

Rednas83 avatar Dec 29 '21 16:12 Rednas83