Rank 2: Process
business_owner_id will be unique value but return value only gives me document list not collection attribute data
Votes
1
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
business_owner_id will be unique value but return value only gives me document list not collection attribute data
Moderator
In such case:
Query.equal("bussines_owner_ID", ["a123123qqwe"])
Should return all documents that have an attribute business_owner_id that equals to a123123q
I understand, it was an example. Since business owner ID is unique, you can use that ID as your searchable key rather then running the query you mentioned -> as @D5 pointed.
Moderator
Full example:
import 'package:appwrite/appwrite.dart';
void main() async { final client = Client() .setEndpoint('https://cloud.appwrite.io/v1') .setProject('[PROJECT_ID]');
final databases = Databases(client);
try { final documents = await databases.listDocuments( '[DATABASE_ID]', '[COLLECTION_ID]', [ Query.equal("bussines_owner_ID",["a123123qqwe"]) ] ); } on AppwriteException catch(e) { print(e); }}Rank 1: Thread
You need to specify your bussines_owner_ID into Indexes after that your query working
Rank 2: Process
Something like this ?
Rank 1: Thread
Yessss
Rank 1: Thread
Key And Attribute names are same
Rank 1: Thread
bussines_owner_ID
Rank 2: Process
It should be same or not ?
Moderator
In the latest version it's not needed using attributes, however very recommended since it improves performance
Rank 1: Thread
It should be same
Rank 2: Process
And how do you access attribute value ? like test[0].@business_name
Rank 1: Thread
test[index].attributeName
Rank 2: Process
🥲
Rank 2: Process
test[0].$collectionId
For this is showing me correct collectionID
Moderator
Could you please send all the code? (Related to appwrite)
Rank 2: Process
🥲
Rank 2: Process
{
"total": 5,
"documents": [
{
"$id": "5e5ea5c16897e",
"$collectionId": "5e5ea5c15117e",
"$databaseId": "5e5ea5c15117e",
"$createdAt": "2020-10-15T06:38:00.000+00:00",
"$updatedAt": "2020-10-15T06:38:00.000+00:00",
"$permissions": [
"read("any")"
]
}
]
}
i can only able to access this $ keys only but not able to access my collection attributes
Rank 1: Thread
Share SS of Db
Rank 2: Process
Rank 2: Process
I got the solution
I need to use something like this
print(test[0].data['business_name']);
Rank 2: Process
Thank You Guys @joeyouss @Nikunj Panchal 🌿 @D5
Rank 1: Thread
Moderator
[SOLVED] how to get database collections attribute value using flutter ?