-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential enhancement #5
Comments
Will be good improvement 👍 What name should have this option? |
We should probably add a testSchema.path('count').set(function(value) {
return this.count ? this.count : value;
}); However, this will prevent any editing at all. We could do something like: counterSchema.path('count').set(function(value) {
if (value - this.count !== settings.incrementBy) {
return this.count ? this.count : value;
}
return value;
}); Thoughts? |
It will not work with Somewhere here https://github.com/nodkz/mongoose-plugin-autoinc/blob/master/src/index.js#L315 we should add check on doc.isModified('counter') and then use doc.$ignore('counter') if |
To tell the truth its bit too much. no DB protectes you from updating the index that you autoincrement - ever. ^^ So I would vote on dropping this one |
Create an option to make the field uneditable? At the moment, you'd have to write custom logic to prevent people from sending the incremented field along with a request?
The text was updated successfully, but these errors were encountered: