pocketbase / js-sdk

PocketBase JavaScript SDK

Home Page:https://www.npmjs.com/package/pocketbase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I retrieve field values from pocketbase records?

ItsTerm1n4l opened this issue · comments

Im trying to build a website using pocketbase for the backend and svelte for the frontend JS, I have created records like so;
20231212_17h41m13s_grim
and I need to get the value of the name field of all the records in the parts collection and display them in a dropdown box in my site, how do I do this?
Thank You.

You can call getList() (for paginated records list) or getFullList() (for all collection records):

const records = await pb.collection("parts").getFullList();

Note that by default new collections have "Admin only" API rules. You can manage the permissions to your collection from the collection settings (cogwheel) > API rules.

For more details and examples you can explore the "API Preview" section of the collection or explore the generic web API docs at https://pocketbase.io/docs/api-records/.

If you need further help, for general PocketBase usage questions please consider opening a Q&A discussion instead.