Skip to content
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

Optimistic concurrency: select subset of fields to apply optimistic concurrency to #10591

Closed
vkarpov15 opened this issue Aug 23, 2021 · 0 comments
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@vkarpov15
Copy link
Collaborator

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

The Schema optimisticConcurrency option is currently a boolean: optimistic concurrency is either on for the whole document, or off for the entire document. Would be nice to allow specifying either fields to enable optimistic concurrency:

const opts = { optimisticConcurrency: ['status'] };

new Schema({
  name: String,
  age: Number,
  status: { type: String, enum: ['PENDING', 'APPROVED', 'REJECTED' ] }
}, opts);

Or fields to exclude from optimistic concurrency:

const opts = { optimisticConcurrency: { exclude: ['name'] } };

new Schema({
  name: String,
  age: Number,
  status: { type: String, enum: ['PENDING', 'APPROVED', 'REJECTED' ] }
}, opts);

See #10583

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

@vkarpov15 vkarpov15 added this to the 5.x Unprioritized milestone Aug 23, 2021
@vkarpov15 vkarpov15 added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Aug 23, 2021
@vkarpov15 vkarpov15 modified the milestones: 7.x Unprioritized, 7.3.0 Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

1 participant