# Document QML Type

Document proxies a single document stored in the Database. More...

Import Statement: | import U1db .
Instantiates: | Document

- List of all members, including inherited members

## Properties

- content : Variant
- contents : Variant
- create : bool
- docId : string

## Detailed Description

This is the declarative API equivalent of Database::putDoc() and Database::getDoc().

    Document {
        docId: 'myId'
        defaults: {
            color: 'blue'
        }
        create: true
    }

See also Database.

## Property Documentation

content : Variant

The default contents of the document, which are used only if create is true, docId is not empty and no document with the same docId exists in the database yet. If the defaults change, it's up to the API user to handle it.

contents : Variant

Updates the contents of the document. A valid docId must be set.

create : bool

If create is true, docId is not empty and no document with the same docId exists, defaults will be used to store the document.

docId : string

The docId can be that of an existing document in the database and will determine what getContents() returns. If no such documents exists, setDefaults() can be used to supply a preset.