SQL translation into FQL Query

I need to list all id of documents in collection. I was following this:

in Sql what I want to do would be:
SELECT id from Person

but in the example here, it will return all “columns” of Person. (SELECT * from Person)

How can I make an index that specify only id from the collections?

Hi @adbaga and welcome!

with id you mean the document Ref or any other field?

Luigi

Yes, what I meant was actually Ref

Is it true if I write it like this?

Select(['ref'], Map(Paginate(Index("all_people")), Lambda("X", Get(Var("X")))))

Hi @adbaga, @ronyfhebrian,

it very depends on how the index was built. For instance, if you have that index:

Get(Index('allUsers'))
{ ref: Index("allUsers"),
  ts: 1603270202150000,
  active: true,
  serialized: true,
  name: 'allUsers',
  source: Collection("users"),
  partitions: 8 }

you can issue such query:

Map(Paginate(Match("allUsers")), Lambda("X", Var("X")))

and avoiding getting the real document.
You can even do that witout an jndex by issuing:

Paginate(Documents(Collection(<collection_name>)))

In case you index is different, you can post here, and I can send back the query to you.

@ronyfhebrian: you query wont work, you have to write this way:

 Map(Paginate(Match("allUsers")), Lambda("X", Select(['ref'],Get(Var("X")))))

in case.

Hope this helps.

Luigi