two questions. the Server SDK for NodeJS says that if I want to do a 'verification' i think that means to set a users 'verified' status, the first parameter is a URL?! see sample.
secondly, to update a document i have to know the document id? can't i just query for it? i suppose i can, if the next parameter is an array of Query objects, but it should be documented. UPDATE: nope. i can't.
this should work, but
80 databases.getDocument('cryptfire', 'api', [
81 Query.equal('key', apikey)
82 ]);
it may make more sense in this case
80 databases.updateDocument('cryptfire', 'api', [
81 Query.equal('key', apikey)
82 ]);
because then you can do this, although it probably isn't best practice
try {
databases.getDocument('cryptfire', 'api', [
Query.equal('key', apikey)
]);
// do here what you gotta do
} catch (err) {
res.send('wrong apikey');
}
thx & sry
Please don't put multiple topics in a single post. The point of having support posts is to be able to focus on a single problem.
You can think of get document as get document by id, list documents as find or query for documents, and update document as update document by id. These are the methods available to you so you can use them accordingly. If you want to create some sort of wrapper method does a list documents and then update document, you are free to do so
i understand. i finally got to the OpenAPIv3 spec, so with some focus, i should be able to go my ways with it now. I'm looking to increase the quality and lower the frequency of my questions.
If you're looking for some inspiration for a wrapper around the database methods you could take a look at: https://www.npmjs.com/package/appwrite-database-repository?activeTab=code It doesn't have a updateDocumentBy method yet but that would be a great addition π
Recommended threads
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...
- Appwrite exception: user_unauthorized, t...
After refreshing the app it is working perfectly