Getting Started

Macros and Modifiers

Use macros and key modifiers in your queries.

Key Modifiers

Native PocketBase query modifiers are supported:

  • :lower: Case-insensitive matching (not needed for .like() operators).
  • :length: Array length check.
  • :each: Array each element check.
pbQuery<Post>()
  .equal('title:lower', 'hello world') // Case-insensitive (not needed for .like() operators)
  .equal('tags:length', 5) // If array length equals 5
  .equal('tags:each', 'Tech'); // If every array element equals 'Tech'

Macros

Native PocketBase datetime macros are supported:

  • @now: Current datetime.
  • @yesterday: 24 hours before @now.
  • @tomorrow: 24 hours after@now.
  • @todayStart: Current date (00:00:00.000Z).
  • @todayEnd: Current date (23:59:59.999Z).
  • @monthStart: Current month (00:00:00.000Z).
  • @monthEnd: Current month (23:59:59.999Z).
  • @yearStart: Current year (00:00:00.000Z).
  • @yearEnd: Current year (23:59:59.999Z).
  • more...
pbQuery<Post>()
  .between('created', '@now', '@yesterday') // Created between now and tomorrow