MoveDatabase

Copied!
( from, to )

Description

The MoveDatabase function moves the from database into the to database, making from a child database of to.

You must use an admin key that has access to the from database or MoveDatabase fails.

Parameters

Parameter Type Definition and Requirements

from

A database reference for the database to be moved.

to

A database reference for the new parent database of from.

Returns

A database reference for the moved database.

Examples

The following example creates the stamps database and the hobbies database, and then moves the stamps database into the hobbies database:

Copied!
Promise.all([
  client.query(
    q.({ name: 'stamps' })
  ),
  client.query(
    q.({ name: 'hobbies' })
  ),
])
.then(([stamps, hobbies]) => client.query(
  q.(stamps.ref, hobbies.ref)
))
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
{
  ref: ("stamps", ("hobbies")),
  ts: 1592113609950000,
  name: 'stamps',
  global_id: 'yqh1r886wybyy'
}
Query metrics:
  •    bytesIn:  155

  •   bytesOut:  230

  • computeOps:    1

  •    readOps:    0

  •   writeOps:    2

  •  readBytes:  323

  • writeBytes:  952

  •  queryTime: 46ms

  •    retries:    0

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!