Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fetch all instances in a FaunaDB class

Tags:

java

faunadb

I have a class "posts" which has 10 instances. How to fetch and list all instances in this class using fauna-java library without using Paginate method?

I tried something like follows

client.query(Get(Class("posts")))

But couldn't able to achieve this.

like image 773
Achaius Avatar asked Aug 23 '18 13:08

Achaius


1 Answers

The Paginate function is present in Fauna to address requesting sets of data. In your case you can play with the pagesize argument and increase it up to a point. Keep in mind that after a certain size you will want to use the paginate function to traverse the larger set.

The simple version of paginate with pages size set would look something like this:

Paginate(Match(Index("customer_id_filter"))).size(Value(pageSize));

A more robust example of using paginate can be found here:

like image 91
Cary Bourgeois Avatar answered Nov 14 '22 10:11

Cary Bourgeois