Closed
Description
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.