Documents

Copied!
( collection )

Description

The Documents function returns the set of documents that exist in the specified collection.

Before the Documents function was introduced, you needed to create an index just to facilitate retrieving documents from a collection. See the Indexing tutorials for details.

Parameters

Parameter Type Definition and Requirements

collection

A Reference to the collection from which documents should be collected.

Returns

A Set Reference which represents all of the documents in the specified collection.

Examples

The following query returns three documents in the Letters collection (established as part of the Index tutorials):

Copied!
((('Letters')), { size: 3 })
{
  after: [ (("Letters"), "104") ],
  data: [
    (("Letters"), "101"),
    (("Letters"), "102"),
    (("Letters"), "103")
  ]
}
Query metrics:
  •    bytesIn:    60

  •   bytesOut:   449

  • computeOps:     1

  •    readOps:     8

  •   writeOps:     0

  •  readBytes: 1,216

  • writeBytes:     0

  •  queryTime:  12ms

  •    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!