Documents

Documents( collection )
Documents( collection )
Documents( collection )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.

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):

System.out.println(
    client.query(
        Paginate(Documents(Collection("Letters"))).size(3)
    ).get());
client.query(
  q.Paginate(q.Documents(q.Collection("Letters")), { size: 3 }),
)
.then((ret) => console.log(ret))
println(Await.result(
  client.query(
    Paginate(Documents(Collection("Letters")), size = 3),
  ),
  5.seconds
))
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
{after: [ref(id = "104", collection = ref(id = "Letters", collection = ref(id = "collections")))], data: [ref(id = "101", collection = ref(id = "Letters", collection = ref(id = "collections"))), ref(id = "102", collection = ref(id = "Letters", collection = ref(id = "collections"))), ref(id = "103", collection = ref(id = "Letters", collection = ref(id = "collections")))]}
{ after: [ Ref(Collection("Letters"), "104") ],
  data:
   [ Ref(Collection("Letters"), "101"),
     Ref(Collection("Letters"), "102"),
     Ref(Collection("Letters"), "103") ] }
{after: [ref(id = "104", collection = ref(id = "Letters", collection = ref(id = "collections")))], data: [ref(id = "101", collection = ref(id = "Letters", collection = ref(id = "collections"))), ref(id = "102", collection = ref(id = "Letters", collection = ref(id = "collections"))), ref(id = "103", collection = ref(id = "Letters", collection = ref(id = "collections")))]}

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!