Collection Events

In the noonjs, whenever a collection undergoes a change (create, update, or delete), an event is triggered, notifying all clients specified in config.json.

IO

If io is true, it indicates that the event originated from the server, meaning the document might contain fields filtered based on user permissions.

Created

The created event is triggered when a new document is added to the collection.

client.collection("todos").on("created", (todo, io) => {
// do something with todo
})

Updated

The updated event is triggered when an existing document in the collection is modified. The received todo object contains the updated data.

client.collection("todos").on("updated", (todo, io) => {
// do something with todo
})

Deleted

The deleted event is triggered when a document is removed from the collection. The todo object contains the removed document's details.

client.collection("todos").on("deleted", (todo, io) => {
})
Edit this page on Github
© 2025 kav3.com. Crafted with and dedication.