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

Bug: upsert function does not work if one of the fields is readonly, even if it is not mentioned #360

Open
2 tasks done
Nipodemos opened this issue Oct 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Nipodemos
Copy link
Contributor

Describe the bug

When you try to use upsert, and the record already exists, and the record has a field that is readonly, it'll show the following error:

ResponseError: There was a problem with the database: Found changed value for field `updatedAt`, with record `test:nipo`, but field is readonly
      at new SurrealDbError (:1:33)
      at new ResponseError (C:\Users\Alan\Projetos Web\bugreportsurrealdbjs\node_modules\surrealdb\dist\index.mjs:1:4603)
      at C:\Users\Alan\Projetos Web\bugreportsurrealdbjs\node_modules\surrealdb\dist\index.mjs:1:49206

Steps to reproduce

i've created a repo with a minimal reproducible code: Link to repo

but the steps are:

  1. create a table that has at least one readonly field
  2. create a record, it must exist to error to appear
  3. try use upsert on that existing record

Expected behaviour

to update only the fields i've mentioned on upsert function

SurrealDB version

2.0.2 for windows on x86_64

JavaScript SDK version

1.0.6

Contact Details

[email protected]

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Nipodemos Nipodemos added the bug Something isn't working label Oct 12, 2024
@LucyEgan
Copy link

Sounds like its related to surrealdb/surrealdb#4952, does it work as expected against surrealdb 2.0.0-beta.2?

@Nipodemos
Copy link
Contributor Author

I'll check tonight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants