![](https://cdn.discordapp.com/avatars/706890197643690065/1430f8079b1efd44ebfba58bdcadc529.webp)
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>
![](https://cdn.discordapp.com/avatars/256137040838524928/20f0469a72d4ed386593831149d1318d.webp)
Try
const response = await databases.listDocuments(
process.env.REACT_APP_DATABASE_ID,
process.env.REACT_APP_COLLECTION_ID,
[
Query.equal('coordinates',[truncatedPlaceId1])
]
);
![](https://cdn.discordapp.com/avatars/706890197643690065/1430f8079b1efd44ebfba58bdcadc529.webp)
yes thanks error went away
![](https://cdn.discordapp.com/avatars/706890197643690065/1430f8079b1efd44ebfba58bdcadc529.webp)
hey could you clarify this error this is the new error
Error fetching reviews: AppwriteException: Index not found: coordinates at Client.<anonymous>
![](https://cdn.discordapp.com/avatars/256137040838524928/20f0469a72d4ed386593831149d1318d.webp)
Thinks you use cloud
![](https://cdn.discordapp.com/avatars/256137040838524928/20f0469a72d4ed386593831149d1318d.webp)
You need to create index for equal queries
![](https://cdn.discordapp.com/avatars/256137040838524928/20f0469a72d4ed386593831149d1318d.webp)
You can create index directly via console (website)
![](https://cdn.discordapp.com/avatars/706890197643690065/1430f8079b1efd44ebfba58bdcadc529.webp)
okay thanks Bouahaza for your so much fast and correct help
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Use Query by Appwrite correct method
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
FYI, it's best to use 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
and FYI, the queries are documented here: https://appwrite.io/docs/databases-queries
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
[SOLVED]Use Query by Appwrite correct method
![](https://cdn.discordapp.com/avatars/706890197643690065/1430f8079b1efd44ebfba58bdcadc529.webp)
okay thanks Steven I will remember this 😊😊
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
[SOLVED] Use Query by Appwrite correct method
Recommended threads
- GET https://cloud.appwrite.io/v1/account...
create project, create sdk , set the hostname to localhost , give the database as well as storage permission to th user still giving the error
- How can I check whether the current user...
How can I check whether the current user is logged in to OAuth2-Discord? Unfortunately, I don't understand the Appwrite documentation very well and am relative...
- Getting error "[AppwriteException: User ...
Hey guys, I searched the docs, but didn't find a solution. Basically I am making a CRUD app, using react native and email auth in app write. I am getting an e...
![](/images/bgs/pre-footer.png)