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