Back

general_argument_invalid, Index not found: business_owner_id

  • 0
  • Flutter
Pradhumansinh Padhiyar
29 May, 2023, 07:44

What does this error means ??

TL;DR
The error "general_argument_invalid, Index not found: business_owner_id" means that there is no index created for the 'business_owner_id' field in the database. To solve this, you need to create an index for the 'business_owner_id' field. You can do this in the index tab of your appwrite console. Once the index is created, you should be able to fetch data using the provided code. Additionally, make sure that the permissions for the collection are set correctly in the appwrite console.
Pradhumansinh Padhiyar
29 May, 2023, 07:46

final businessDatabyIDResponse = await _db.listDocuments( databaseId: AppwriteConstants.databaseID, collectionId: AppwriteConstants.businessInfoCollections, queries: [Query.equal('business_owner_id', myBusinessDetailsId)], );

my code

Pradhumansinh Padhiyar
29 May, 2023, 07:53

Its resolved now i need to write myBusinessDetailsId like [myBusinessDetailsId]

Pradhumansinh Padhiyar
29 May, 2023, 11:58

Not working

Asutosh
29 May, 2023, 11:59

what is not working ?

Pradhumansinh Padhiyar
29 May, 2023, 11:59

final businessDatabyIDResponse = await _db.listDocuments( databaseId: AppwriteConstants.databaseID, collectionId: AppwriteConstants.businessInfoCollections, queries: [Query.equal('business_owner_id', myBusinessDetailsId)], );

This code

Asutosh
29 May, 2023, 12:00

Alright make sure you have setup the permissions correctly for the collection in appwrite console

Pradhumansinh Padhiyar
29 May, 2023, 12:01

im trying to fetch data where business_owner_id = 'someownerid from auth users'

Pradhumansinh Padhiyar
29 May, 2023, 12:01

Is it correct ?

Asutosh
29 May, 2023, 12:06

Yes this means users have the access

Asutosh
29 May, 2023, 12:07

can you pls send the error message

Pradhumansinh Padhiyar
29 May, 2023, 12:08

Its in the subject 400 generak_argument_invalid, index not found:business_owner_id

Asutosh
29 May, 2023, 12:11

You are using appwrite cloud right ?

Pradhumansinh Padhiyar
29 May, 2023, 12:12

yes

Asutosh
29 May, 2023, 12:12

ok so i think you need to create an index go to the index tab and create an index for business_owner_id field

Pradhumansinh Padhiyar
29 May, 2023, 12:14

why ?

Asutosh
29 May, 2023, 12:17

In order to do queries you need to create index

Asutosh
29 May, 2023, 12:21

You can learn more about them here https://appwrite.io/docs/databases#indexes

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