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

Argument Type Definition and Requirements

collection

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

Returns

A SetRef 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!
client.query(
  q.(q.(q.('Letters')), { size: 3 }),
)
.then((ret) => console.log(ret))
{ after: [ (("Letters"), "104") ],
  data:
   [ (("Letters"), "101"),
     (("Letters"), "102"),
     (("Letters"), "103") ] }

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!