7

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.

Achaius
  • 5,904
  • 21
  • 65
  • 122

2 Answers2

1

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:

MyStackRunnethOver
  • 4,872
  • 2
  • 28
  • 42
0

You can't. Matches on an index give you sets, but if you'd like to instantiate that set into a concrete collection, then you must call paginate. Why are you trying to avoid paginate?

Or course if you already had a collection of 10 refs you could send a query with the 10 refs, and map over it to produce the data. So if you had a deterministic ref scheme you could do that, but that seems a bit weird.

benjumanji
  • 1,395
  • 7
  • 15