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

Question Code breaks optimistic concurrency supported by mongoose #472

Open
OliverFischer opened this issue Dec 20, 2024 · 0 comments
Open

Comments

@OliverFischer
Copy link
Contributor

OliverFischer commented Dec 20, 2024

Hi guys, just a simple question:

In operations.ts the versionKey is completely removed from the document to save:

// @ts-expect-error this is fine 🐶🔥
    if (contextModel.schema.options.versionKey) {
      // @ts-expect-error this is fine 🐶🔥
      delete req.body[contextModel.schema.options.versionKey];
    }

Looks like this breaks the mechanism of optimisticConcurrency . It was originall introduced by @florianholzapfel here: 53c44c4. Ok, thirteen years ago, but do you perhaps remember the reason for introducing this behaviour?

BTW: I checked out the latest version and commented the lines in create/modifyObject, made a build and all tests are still running. May be some refactoring of populate and depopulate in the meantime made the original problem obsolete?

2nd annotation: Should we modify the test command to something like "test": "rm -rf dist && npm run build && run-s test:*" to always test on a fresh distro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant