Back

I am facing issue in forming a query in JS

  • 1
  • Web
Binyamin
5 May, 2024, 16:26

They don't match each other.

TL;DR
Developers facing issues forming a query in JS regarding preventing duplicate entries in Appwrite. The developer should set a unique index on the attribute in the collection ID. Instead of `getDocument`, they should use `listDocument` with queries. The developer is advised to check the Appwrite version, use `await` within a `try/catch` block, and handle promises correctly. The developer should share their code and the specific error for assistance.
Brownie
5 May, 2024, 16:26

see the issue is that I want only one user can give one response ,

Brownie
5 May, 2024, 16:27

so I am running query to check if the response is greater than error

Binyamin
5 May, 2024, 16:27

☝️

Brownie
5 May, 2024, 16:33

see I only used appwrite only

Brownie
5 May, 2024, 16:33

not sdk

Binyamin
5 May, 2024, 16:33

What is your appwrite version?

Brownie
5 May, 2024, 16:36

14.0.1

Binyamin
5 May, 2024, 16:36

Your Appwrite instance

Binyamin
5 May, 2024, 16:36

Not the package

Brownie
5 May, 2024, 16:36

this iis happenning due to the query error

Binyamin
5 May, 2024, 16:37

You'll see it here

Brownie
5 May, 2024, 16:37

rest all appwrite features is working

Brownie
5 May, 2024, 16:37

means?

Binyamin
5 May, 2024, 16:37

What version do you see here?

Brownie
5 May, 2024, 16:38

1.5.5

Brownie
5 May, 2024, 16:45

???

Brownie
5 May, 2024, 16:46

@Binyamin

Binyamin
5 May, 2024, 16:47

Okay,

Binyamin
5 May, 2024, 16:48

You should use listDocument with queries instead of getDocuemnt

Binyamin
5 May, 2024, 16:48

Can you explain what you're trying to do?

Brownie
5 May, 2024, 16:51

As I told I don't want a duplicate entries , so I am running a query to check if the userName exists or not

Brownie
5 May, 2024, 16:51

in the collection ID

Binyamin
5 May, 2024, 16:51

You can set a unique index on that attibute

Binyamin
5 May, 2024, 16:51

So Appwrite will prevent you from inserting duplicate entries

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