Search code examples
databasedbaasbackand

Automatic deletion of fields in my DB


I'm using Backand as my BaaS and I’m looking for a quick way to delete entries I no longer need. In the data model I created, I have an object called “Auctions”, in this object I want to add an action that delete the entries that surpassed the end time of the auction.

I’ve been looking in the server-side actions and I didn’t find a quick way to do it.

Thanks


Solution

  • There are 2 approaches for this issue:

    1. Create a scheduled task that will delete them
    2. Create a predefined filter that will filter them

    The downside for the first approach is that there will be gaps in times between the scheduled deletion that those entries will still exist.

    I recommend the second approach, let me know if you are interested in the first and I will send instructions.

    For the second, you need to go to the security tab of the object with the relevant entries. In there you can set a predefined filter either with SQL or NoSQL that will always filter expired entries. This will act as if those entries do not exist for every GET request.