3

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?

monomonedula
  • 606
  • 4
  • 17

1 Answers1

3

You can filter based on the backlink like this:

select Bar filter .<bar.id = <uuid>'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 .<bar.id = <uuid>'df492862-80aa-11ed-832e-e72d12452736'
  set { baz := false };
raddevon
  • 3,290
  • 4
  • 39
  • 49