Repository navigation
|
I have two models and would like them to share the same topic_id counter. @plugin(AutoIncrementID, {
field: "topic_id",
trackerCollection: "meta",
trackerModelName: "Topic",
startAt: 100
})
export class Topic{
@prop({ type: Number, index: true, unique: true })
public topic_id!: number;
...
}export class Message extends Topic {
@prop({ type: Boolean, default: true, required: true })
public is_private!: boolean;
}With the above code, I still got two docs in the meta collection: I thought |
Replies: 1 comment 3 replies
currently it is not possible to share a counter for multiple models (though on request i may look into adding such a option to overwrite the modelName) |

trackerModelNamesets the name for the model that stores the counter, not themodelNameproperty (this is what the documentation is trying to say, but may be not enough on second looks)as a side note, all properties that start with
trackeraffect the tracker schema / model itself, not the data insidecurrently it is not possible to share a counter for multiple models (though on request i may look into adding such a option to overwrite the modelName)