improve id incrementing logic

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-04-01 18:48:14 -04:00
parent 322d97dc95
commit 93b81308cb
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -222,9 +222,9 @@ func incrementTagged(item interface{}) interface{} {
} else { } else {
cur.Set(reflect.ValueOf(incrementInterface(nid))) cur.Set(reflect.ValueOf(incrementInterface(nid)))
} }
counterColl := DB.Collection(COUNTER_COL)
counterColl.UpdateOne(context.TODO(), bson.M{"collection": incTag.Name}, bson.M{"$set": bson.M{"collection": incTag.Name, "current": cur.Interface()}}, options.UpdateOne().SetUpsert(true))
} }
counterColl := DB.Collection(COUNTER_COL)
counterColl.UpdateOne(context.TODO(), bson.M{"collection": incTag.Name}, bson.M{"$set": bson.M{"collection": incTag.Name, "current": cur.Interface()}}, options.UpdateOne().SetUpsert(true))
} }
return rv.Elem().Interface() return rv.Elem().Interface()