method

Value.CopyDocument

Copy a populated document for editing or interoperability.

Example

go
author, populated := page.Values["author"].CopyDocument()
if populated {
  fmt.Println(author.ID)
}

Returns

A detached document and true when populated; otherwise an empty document and false.

(Document, bool)

How it works

Metadata and field maps are copied. Child Values remain immutable.

Full signature

Related types

  • Value

    An immutable scalar, object, list, or populated document value.

  • Document

    A stored document with status and version metadata.

Related guides