Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Feature: "createdAt" and "updatedAt" fields in documents #3011

Closed
2 tasks done
dedonnodev opened this issue Mar 25, 2022 · 7 comments
Closed
2 tasks done

馃殌 Feature: "createdAt" and "updatedAt" fields in documents #3011

dedonnodev opened this issue Mar 25, 2022 · 7 comments
Assignees

Comments

@dedonnodev
Copy link

馃敄 Feature description

Two timestamp fields for every document for know when this was created or was updated.

馃帳 Pitch

I started to use a function to handle this, triggering it with document.create and document.update.
But it goes in loop when has to update the "updatedAt" field, because every time it updates the field, triggers itself.

So, since i think this two fields are often used (for sort from most recent/updated for example), i think it would be an awesome idea have them "defaults" and handled by appwrite.

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@JakeAi
Copy link

JakeAi commented Mar 25, 2022

+99

@ay1man4
Copy link

ay1man4 commented Mar 29, 2022

Having such fields help developers from the need of creating functions and avoid recursion issue.

@Meldiron
Copy link
Contributor

As mentioned here #3018
We plan to do this 馃槑 First, we will add date attribute. Then, all documents would have $createdAt and $updatedAt just like there is $id by default. These attributes would be un-indexed, but you could add index if you want to use then for sorting/filtering.

We are also thinking about supporting some syntax similar to unique(), something like now(), so when using the date attribute, you could make your own logic for when the value is updated. THe now() lets you take current time from the server, instead of asking to from the client (possible timezone issues).

All is still just an idea on paper, and anything can change. To keep up to date, join our Discord as we post weekly updates in there about what we work on.

@JakeAi
Copy link

JakeAi commented Mar 31, 2022

We are also thinking about supporting some syntax similar to unique(), something like now(), so when using the date attribute, you could make your own logic for when the value is updated. THe now() lets you take current time from the server, instead of asking to from the client (possible timezone issues).

This is an excellent idea. I highly recommend doing this.

@everly-gif
Copy link
Contributor

Hi @dedonnodev , This feature is now supported with the latest release 0.15 .
You can read about it here : Introducing $createdAt And $updatedAt On Each Resource

@SMARTMICROWORLD
Copy link

SMARTMICROWORLD commented Sep 8, 2023

馃敄 Feature description

Two timestamp fields for every document for know when this was created or was updated.

馃帳 Pitch

I started to use a function to handle this, triggering it with document.create and document.update. But it goes in loop when has to update the "updatedAt" field, because every time it updates the field, triggers itself.

So, since i think this two fields are often used (for sort from most recent/updated for example), i think it would be an awesome idea have them "defaults" and handled by appwrite.

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

Please also allow us to edit/modify $createdAt attribute because it is very painful when we migrate from another database like firebase, supabase...etc
I highly recommend this, you can only allow us to do this by server side. BTW thanks馃グ

@SMARTMICROWORLD
Copy link

As mentioned here #3018 We plan to do this 馃槑 First, we will add date attribute. Then, all documents would have $createdAt and $updatedAt just like there is $id by default. These attributes would be un-indexed, but you could add index if you want to use then for sorting/filtering.

We are also thinking about supporting some syntax similar to unique(), something like now(), so when using the date attribute, you could make your own logic for when the value is updated. THe now() lets you take current time from the server, instead of asking to from the client (possible timezone issues).

All is still just an idea on paper, and anything can change. To keep up to date, join our Discord as we post weekly updates in there about what we work on.

I am so disappointed because Appwrite account.createOAuth2Session('google'); is not supported in react native. Any plan for future. I was migrating to Appwrite but because of incompatibility I am again switching to firebase 馃ゲ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants