Skip to content
Back

get Users Data in Array

  • 0
  • Flutter
  • Cloud
Zionnite
15 Apr, 2024, 03:51

hello, i have list of user in array like this PosterId [18148422710, 13428633922, 221257741408, 563323559863] i want to get the post made by this users so i did something like this in my code

TypeScript
        databaseId: Common.dataBasesId,
        collectionId: Common.postCollection,
        queries: [
          Query.orderDesc('postedAt'),
          Query.limit(15),
          Query.equal('repliedTo', ''),
          Query.search('uid', "[$feedPosterIds]"),
        ],
      );```

i have already index uid for `fullText`
Nothing is being returned, the outputted lenght its zero, please how do i achieve this?
TL;DR
Developers are trying to get user data in an array but having trouble with the query in Flutter. They are attempting to search for documents with specific IDs but not getting the desired results. The solution suggested is to make separate requests for each ID instead of passing them all into `Query.search()`. Additionally, ensure to use version 1.5 of Appwrite.
ideclon
15 Apr, 2024, 03:58

I'm not quite clear on what's happening here. What's your Collection schema?

Zionnite
15 Apr, 2024, 03:59
ideclon
15 Apr, 2024, 05:04

What if you just use the Query.search() and remove the rest of the Queries for now?

zionnite.
15 Apr, 2024, 07:55

Yes, I have done that too

zionnite.
15 Apr, 2024, 09:09

Okay, this is what I want to achieve maybe I'm not doing it correctly.

I have users collection and a post collection

In users collection I have an userId attributes and follower and following attributes

Post collection consist of the post the user send from the app to the database.

In the App, I have people I am following.

So I want to get the post of those people I am following along with my own Post.

Please how do I achieve this?

Zionnite
15 Apr, 2024, 14:46

Please support here....

Zionnite
15 Apr, 2024, 15:27

from the Appwrite Docs, https://appwrite.io/docs/products/databases/queries it show the Query.contains() Keyword but i cant find that in my Flutter client sdk, i'm using client sdk appwrite: ^11.0.1

Ireneus
15 Apr, 2024, 15:34

contains query was added in 12.0.0

Ireneus
15 Apr, 2024, 15:34
Ireneus
15 Apr, 2024, 15:35

make sure you use v1.5 aswell

Zionnite
15 Apr, 2024, 15:35

I'm using cloud and cloud version its not yet v1.5 yet

Ireneus
15 Apr, 2024, 15:37

😞

ideclon
15 Apr, 2024, 15:50

Oh, wait - I think that if you pass three ids into Query.search() it will only return if all three are in a Document, not if any of them are in one.

Zionnite
15 Apr, 2024, 15:56

yes, thats what i aim to achieve but its not working

ideclon
15 Apr, 2024, 15:57

In Appwrite 1.5 we have Query.or(), but for now you might have to do separate requests for each id.

Zionnite
15 Apr, 2024, 15:59

please explain...

ideclon
15 Apr, 2024, 16:05

You have an array of IDs and you want to get all Documents where uid contains any of them, right? But if you pass in all of them to Query.search(), Appwrite will return only Documenrs which contain all of them, which is, of course, non of them.

Zionnite
16 Apr, 2024, 09:44

no, i dont think so @ideclon , if thats true what about searching for a user name, it return using where mostly have those name

Zionnite
16 Apr, 2024, 09:48

okay, i got you now @ideclon

Zionnite
17 Apr, 2024, 12:06

hello @Steven please whats your insight into this issue, please i need a way to fix this so i can deploy to stores

thanks everyone

Steven
17 Apr, 2024, 14:34

Do not tag people as it can be disruptive

Zionnite
17 Apr, 2024, 15:43

i'm so sorry boss

zionnite.
18 Apr, 2024, 00:04

Pls any idea 💡

Zionnite
10 Sep, 2025, 18:07

m

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more