-
-
Notifications
You must be signed in to change notification settings - Fork 4k
[Bug] optimisticConcurrency nested paths #16054
Copy link
Copy link
Open
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the issue has not already been raised
Issue
optimisticConcurrency option needs to handle nested paths properly, it currently doesn't.
Should handle both directions: profile means optimisticConcurrency is triggered by profile.name, and profile.address.country should be triggered by setting profile.address.
const profileSchema = new Schema({ firstName: String, lastName: String }, { _id: false });
const userSchema = new Schema({
profile: profileSchema,
balance: Number
}, { optimisticConcurrency: { exclude: ['profile'] } });
const User = mongoose.model('User', userSchema);
const user = await User.create({ profile: { firstName: 'Alice', lastName: 'Smith' }, balance: 100 });
user.profile.firstName = 'Bob';
user.$__delta();
// BUG: user.$__.version === VERSION_ALL (3)
// EXPECTED: user.$__.version === undefined (profile is excluded, so profile.firstName should be too)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels