# How to update an ID field?

**URL:** <https://discuss.dgraph.io/t/how-to-update-an-id-field/15692>\
**Category:** GraphQL\
**Tags:** kind:question\
**Created:** [September 30, 2021, 3:59pm UTC](https://discuss.dgraph.io/t/how-to-update-an-id-field/15692 "2021-09-30T15:59:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ian/32/3461_2.png) [@ian](https://discuss.dgraph.io/u/ian)\
**Post date:** [September 30, 2021, 3:59pm UTC](https://discuss.dgraph.io/t/how-to-update-an-id-field/15692/1 "2021-09-30T15:59:31Z")

</div>

When you mark a field as @id, it the AddXInput will have the field but the UpdateXInput will not. How do you update an @id field?

---

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [October 1, 2021, 4:02am UTC](https://discuss.dgraph.io/t/how-to-update-an-id-field/15692/2 "2021-10-01T04:02:48Z")

</div>

> [@Can I update fields with the @id directive?](http://discuss.hypermode.com/t/can-i-update-fields-with-the-id-directive/15573/4):
>
> You can update the data using a DQL mutation. If you don’t have the uid mapped in GraphQL using ID then you can do an upsert using your field with @id. type User { username: String @id isActive: Boolean } upsert { query { user as var(func: eq(User.username,"foo")) } mutation { set { uid(user) \<User.username\> "bar" . } } }
