Query Database data field

Hello

Total faunadb newbie here

I saw here: Databases | Fauna Documentation that there’s a data object on the Database to store some metadata. However I couldn’t find any example on how to query/set that data field for a specific Database.

Any help or link would be appreciated.

Thanks!

Here is an example>

I have parentdb in the root scope.

Paginate(Databases());

{
  data: [Database("childdb")]
}
Get(Database('childdb'));

{
  ref: Database("childdb"),
  ts: 1615229371440000,
  name: "childdb",
  global_id: "yo8u6bmtqydyr"
}

Update childdb with a data field.

Update(Database('childdb'), {
 data: {
    desc: "This database holds child database info."
    }
  }
)

{
  ref: Database("childdb"),
  ts: 1615229447755000,
  name: "childdb",
  data: {
    desc: "This database holds child database info."
  },
  global_id: "yo8u6bmtqydyr"
}

Get Database info.

Get(Database('childdb'));

{
  ref: Database("childdb"),
  ts: 1615229447755000,
  name: "childdb",
  data: {
    desc: "This database holds child database info."
  },
  global_id: "yo8u6bmtqydyr"
}

Get the data field

Select(['data'],Get(Database('childdb')))

{
  desc: "This database holds child database info."
}

Thank you very much Jay

Is it posible to do the same operations with the parentdb?

El El lun, 8 mar 2021 a las 20:07, Jay Kasireddy via Fauna Forums <fauna1@discoursemail.com> escribió:

Not from the Dashboard. You can create a key to root scope using this link. and access the parentdb (database in root scope) from any of the driver programs or Fauna Shell.

I understand in that case that key will have access to all the databases. Right?

Yes. It is the key to access all databases in your root scope.

1 Like