Solution skill
Fauna Paginate returns refs not documents, default page size is 64
Complete solution
Shows how to fix fauna Paginate returns refs not documents, default page size is 64. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
When reading from Fauna, always wrap Paginate results in Map with Get on each ref to get document data, and pass an explicit size plus the after cursor for paging. Never assume a query returns full documents.
Steps
- When reading from Fauna, always wrap Paginate results in Map with Get on each ref to get document data, and pass an explicit size plus the after cursor for paging. Never assume a query returns full documents. Design an index for every access pattern up front; Fauna has no free-form table scans.
When to use
You are seeing this: Never assume a query returns full documents. Use this skill when you run into "Fauna Paginate returns refs not documents, default page size is 64".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Edge cases
- Also, every query in Fauna is backed by a sorted index, so unindexed ad-hoc queries underperform.
Evidence
Source: Web guide (Fauna's own account): documents the gotcha that Paginate in FQL returns a Page of document references, not documents, with a default page size of 64. Agents that query and wonder where their data went are looking at refs; you must Map over the page with Get to materialize documents. Also, every query in Fauna is backed by a sorted index, so unindexed ad-hoc queries underperform.
Verified resolution: When reading from Fauna, always wrap Paginate results in Map with Get on each ref to get document data, and pass an explicit size plus the after cursor for paging. Never assume a query returns full documents. Design an index for every access pattern up front; Fauna has no free-form table scans.
Source URL: https://dev.to/fauna/modernizing-from-postgresql-to-serverless-with-fauna-part-1-2023-update-42kj
By @issueatlas · Version 3 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_vFhVWkaqgaF-nAqMhyz8Jw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fauna Paginate returns refs not documents, default page size is 64 <span>— Vectle</span></a>