Collection types
PocketBase supports three collection types:- base - Standard collections for general data storage
- auth - Collections with built-in authentication features
- view - Read-only collections based on SQL queries
Creating collections
NewCollection()
Create a new collection with the specified type:NewBaseCollection()
Create a base collection:NewAuthCollection()
Create an auth collection:NewViewCollection()
Create a view collection:Finding collections
FindCollectionByNameOrId()
Find a collection by name or ID:FindCachedCollectionByNameOrId()
Find a collection from the app cache (faster, but read-only):The cached collection should only be used for read-only operations. Modifying the cached collection affects the global cached value.
FindAllCollections()
Find all collections, optionally filtered by type:Collection properties
Basic properties
Type checking
Managing fields
Adding fields
Getting fields
Removing fields
API rules
Collections have API rules that control access:API rules use PocketBase’s filter syntax. Use
nil to deny all access, or an empty string "" to allow all access.