auto-increment icon indicating copy to clipboard operation
auto-increment copied to clipboard

Increment key based on another field

Open iamchathu opened this issue 5 years ago • 6 comments

Let's say we have Incremented Value(ref) in the document which need to be incremented based on another field(shopId)

{
   "ref": 12,
   "shopId":1
},
{
   "ref": 13,
   "shopId":1
},
{
   "ref": 1,
   "shopId":2
},
{
   "ref": 2,
   "shopId":2
},
{
   "ref": 14,
   "shopId":1
}

What kind of approach can we have? ( the two properties are compound index)

iamchathu avatar Apr 06 '20 06:04 iamchathu

with this plugin currently not possible (increment value based on other value)

hasezoey avatar Apr 19 '20 12:04 hasezoey

Any update on this?

tiennguyen1203 avatar Jan 16 '24 09:01 tiennguyen1203

like it was said earlier in the comments, it is currently not possible.

if you want it yourself, either implement it and send a PR or better explain what is necessary / wanted.

to summarize (on my understanding), you would need a external (like AutoIncrementID) tracker for the base number, but increment it by another field before applying, tracker + field = newid; or am i misunderstanding something?

hasezoey avatar Jan 16 '24 10:01 hasezoey