Back

Get Document Function returns Response like List Documents

  • 0
  • Databases
SenZi
11 May, 2023, 00:35

Hi, I was using the databases.getDocument but the response i got was like {total: 1, documents: [{}]}. Its like calling the list document function. While checking the docs and from what i have tested earlier, i should be getting just a document object.

Any Idea why this is happening?

TL;DR
The user is experiencing an issue where the 'getDocument' function is returning a response similar to the 'list documents' function. They are concerned about potential deletion of files and asking if there are any serious issues with the bug. The support representative confirms that this behavior is due to an issue with route matching and provides a link to the related issue on GitHub. The user also mentions that providing an empty string as the document ID returns a response like a list of documents. The support representative acknowledges this and suggests that the behavior should return a single document object instead. No solution is provided in the thread.
SenZi
11 May, 2023, 00:44

It seems like if i provide the document id as a blank text, example: " ", it would return the response like a list documents would

SenZi
11 May, 2023, 00:46

In the docs it says the document id is required, but providing it with an empty sting value returns data....

Drake
11 May, 2023, 00:49

Yes, our route matching behaves oddly if a path parameter is an empty string. We're working on fixing this now. Here's the related issue: https://github.com/appwrite/appwrite/issues/5310

SenZi
11 May, 2023, 01:00

Gotcha, it was really confusing, is there any serious issues identified with the bug? anything being deleted or something?

Drake
11 May, 2023, 01:06

As the issue mentions you could end up hitting the wrong endpoint. So deleting a file with an empty file id can call the delete bucket endpoint

SenZi
11 May, 2023, 01:07

but it shouldn't delete anything right?

Drake
11 May, 2023, 01:11

If access permits, it will

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