const fetchReviews = useCallback(async (placeId) => {
const cleanPlaceId = placeId.replace(/[^a-zA-Z0-9_.-]/g, '').replace(/^[^a-zA-Z]/, '');
const truncatedPlaceId = cleanPlaceId.substring(0, 34);
const truncatedPlaceId1 = a${truncatedPlaceId}`;
try {
const response = await databases.listDocuments(
process.env.REACT_APP_DATABASE_ID,
process.env.REACT_APP_COLLECTION_ID,
Query.equal('coordinates',[truncatedPlaceId1])
);
const fetchedReviews = response.documents.map((document) => document.review);
setReviews((prevReviews) => ({
...prevReviews,
[placeId]: fetchedReviews,
}));
} catch (error) {
console.error('Error fetching reviews:', error);
}
}, []); ` I don't know what's causing the error below
Error fetching reviews: AppwriteException: Invalid queries: Value must a valid array and Value must be a valid string and no longer than 4096 chars at Client.<anonymous>
Try
const response = await databases.listDocuments(
process.env.REACT_APP_DATABASE_ID,
process.env.REACT_APP_COLLECTION_ID,
[
Query.equal('coordinates',[truncatedPlaceId1])
]
);
yes thanks error went away
hey could you clarify this error this is the new error
Error fetching reviews: AppwriteException: Index not found: coordinates at Client.<anonymous>
Thinks you use cloud
You need to create index for equal queries
You can create index directly via console (website)
okay thanks Bouahaza for your so much fast and correct help
Use Query by Appwrite correct method
FYI, it's best to use 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.
and FYI, the queries are documented here: https://appwrite.io/docs/databases-queries
[SOLVED]Use Query by Appwrite correct method
okay thanks Steven I will remember this ๐๐
[SOLVED] Use Query by Appwrite correct method
Recommended threads
- Docker Compose MongoDB Setup
everythings work fine but the mongodb fails on startup everytime. log: ``` Generating random MongoDB keyfile... /bin/bash: line 9: : No such file or directory ...
- Auth broken after update from 1.8.0 to 1...
So ive been having issues creating, deleting or updating users on my appwrite instance after i updated from 1.8.0 to version 1.9.0. When trying to create a user...
- Magic Link woes/noob
Magic Link is working; it sends the link to my email. But the link itself always leads to "Page Not Found. The page you're looking for doesn't exist". Clicking ...