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

Patch JSONB field #176

Open
lelandcope opened this issue Apr 9, 2022 · 0 comments
Open

Patch JSONB field #176

lelandcope opened this issue Apr 9, 2022 · 0 comments

Comments

@lelandcope
Copy link

lelandcope commented Apr 9, 2022

When calling a patch route on a jsonb field do i have to pass all the keys or is there a way to say i only want to update a single key in that object?

Currently I am experiencing an issue where I have multiple keys and i am only wanting to update one of them. I call the patch route and my object is being saved with all the keys removed except for the one i wanted to update.

Object example before patch

{
  meta: {
    key1: 'foo',
    key2: 'bar',
    key3: true,
  }
}

Object after patch where i want to update meta.key2 = 'zap'

{
  meta: {
    key2: 'zap'
  }
}

Ideally I would want the data to get merged so my object would look like the following

{
  meta: {
    key1: 'foo',
    key2: 'zap',
    key3: true,
  }
}

Any help would be greatly appreciated

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