Skip to content

beforeSave on all objects, possible? #2102

Closed
@mistre83

Description

@mistre83

Hi to all,
in my application i will have many collections, and one of this is a "recap" with the latest insert in the online collection.

Such as a Blog, a collection with Posts hold all post and a single blog instance have saved for example the latest 10 comments.
When a new post come in, this will be saved in Posts and in "recap" with a FIFO strategy. In this way, i can get "immediately" the last 10 comments without make additional query.

So, to do this i will need a beforeSave function that "check" every collection (because my collection are many, and i dont want to write "the same code" for every one).

I can write a job to do this, but is asynchronous and will need to run very often..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions