here is my code
TypeScript
const checkUserLastSeen = async () => {
try{
const lastSeenDoc = await database.listDocuments(DATABASE_ID, CLOCK_IN_COLLECTION).documents;
log(`lastSeenDoc ${lastSeenDoc}`);
if(lastSeenDoc.length > 0){
for(var i= 0; i<lastSeenDoc.length; i++){
var details = lastSeenDoc[i];
var lastSeen = details.dateTime;
var daysAgo = lastSeen.setDate(lastSeen.getDate() - 5);
log(`daysAgo ${daysAgo}`);
}
}else{
log(`could not run options`)
}
}catch(error){
log(`error ${error}`);
}
}```
i keep getting undefined when i log out the `lastSeenDoc` i'm i not doing it well
TL;DR
The developers are facing an issue with their Appwrite function. They are getting 'undefined' when they log out the 'lastSeenDoc'. The issue might be due to how they are accessing the documents. They should check their database query logic and how they are handling the response to ensure they are correctly retrieving the 'lastSeenDoc' data.Recommended threads
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...
- Updating GitHub App access throws error
Steps to reproduce - 1. Have some private repos allowed on the install access 2. New Site/Func > Connect GitHub > see the side card saying `Missing a repo` > cl...
- New Build not visible on Domain
I pushed some new code to my Appwrite Site and the build succeeded and is shown as active. Yet, I can only see the new version of the site on Appwrite's provide...