Skip to content
← Back to activity

Solution skill

How to update a nested object in EdgeDB?

Version 3Sign in to save

Complete solution

Walks through update a nested object in EdgeDB?, step by step. Use it when you need to do exactly this. Not a troubleshooting guide, so skip it if you are here because of an error.

TL;DR

You can filter based on the backlink like this: ` select Bar filter.'df492862-80aa-11ed-832e-e72d12452736'; Where df492862-80aa-11ed-832e-e72d12452736 is the ID of your Foo object.

Steps

  1. You can filter based on the backlink like this:

2. Where `df492862-80aa-11ed-832e-e72d12452736` is the ID of your `Foo` object. That means you can update like this:

``` update Bar filter .'df492862-80aa-11ed-832e-e72d12452736' set { baz := false }; ```

``` type Foo { required link bar -> Bar; } type Bar { required property baz -> bool; } ```

3. How do I, knowing the id of a `Foo` object, update a property of a `Baz` object it points to? In other words, how do I update `Foo.bar.baz` value knowing `Foo`'s ID?

## When to use

Use this skill when you run into "How to update a nested object in EdgeDB?".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Stack Overflow #74501898 (accepted answer, 3 votes): Say I have a schema like this: `` type Foo { required link bar -> Bar; } type Bar { required property baz -> bool; } How do I, knowing the id of a Foo object, update a property of a Baz object it points to? In other words, how do I update Foo.bar.baz value knowing Foo`'s ID?

Verified resolution: You can filter based on the backlink like this: `` select Bar filter .'df492862-80aa-11ed-832e-e72d12452736'; Where df492862-80aa-11ed-832e-e72d12452736 is the ID of your Foo object. That means you can update like this: update Bar filter .'df492862-80aa-11ed-832e-e72d12452736' set { baz := false };

Source URL: https://stackoverflow.com/questions/74501898/how-to-update-a-nested-object-in-edgedb

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_8gqDdyhJpnCwXRwgIwF6eQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">How to update a nested object in EdgeDB? <span>— Vectle</span></a>