3

i have a collection where the field "users" contains the id's of two users.

how can i search for this dataset where this both user id's are.

enter image description here

i tried

users = ["28gjcow5t1mkn7q", "frvl86sutarujot"]

still don't work

Kyrill
  • 265
  • 1
  • 7
  • 19

2 Answers2

2

had asked the same question on twitter and received an answer from @pocketbase:

  1. Use the "?" ("at least one of") operators, eg.: http://users.id ?= "${userId}"

  2. Use the "~" contain/like operator against the serialized value: users ~ "${userId}"

the secord option solved my problem ❤️

Kyrill
  • 265
  • 1
  • 7
  • 19
0

This is a relation, so there must be a collection that allows you multiple, non unique results, so this table you are looking at to, is the the dataset, you can query the whole dataset on script with

// you can also fetch all records at once via getFullList
const records = await pb.collection('tlds').getFullList(200 /* batch size */, {
    sort: '-created',
});

I sugest you to look into: js-sdk/pocketbase on github.