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
- I can't UNPAUSE my project with the free...
I received an email notifying me that my project had been paused due to inactivity, and the email included a link to "Restore project." However, that button red...
- How to bypass the rate limit on the back...
Once a month my app has a ton of usage and I always run into the Too many requests 429 error. I am trying to optimize the queues and jobs to manage that, but a...
- 401 - Project not accessible in this reg...
Hi Appwrite team, I’m experiencing a Cloud Console issue with my NYC region project. Problem: - Some Console pages return: “401 - Project is not accessible ...