(on-delete <collection> <callback function>)
Listen for an update!
event.
Parameter | Description |
---|---|
collection | keyword/string The collection. |
callback function | function A callback function that accepts three parameters: |
java.util.Date Time of event. | |
map Contains a single _id field with the id of the deleted document. |
Examples
(defn delete-event [time id]
; Do something
)
(on-delete :coll delete-event)
Listen for an `update!` event. | Parameter | Description | | --- | --- | | `collection` | `keyword/string` The collection. | | `callback function` | `function` A callback function that accepts three parameters: | | | `java.util.Date` Time of event. | | | `map` Contains a single `_id` field with the id of the deleted document. | **Examples** ```Clojure (defn delete-event [time id] ; Do something ) (on-delete :coll delete-event) ```
(on-insert <collection> <callback function>)
Listen for an insert!
event.
Parameter | Description |
---|---|
collection | keyword/string The collection. |
callback function | function A callback function that accepts two parameters: |
java.util.Date Time of event. | |
map The inserted document. |
Examples
(defn insert-event [time doc]
; Do something
)
(on-insert :coll insert-event)
Listen for an `insert!` event. | Parameter | Description | | --- | --- | | `collection` | `keyword/string` The collection. | | `callback function` | `function` A callback function that accepts two parameters: | | | `java.util.Date` Time of event. | | | `map` The inserted document. | **Examples** ```Clojure (defn insert-event [time doc] ; Do something ) (on-insert :coll insert-event) ```
(on-update <collection> <callback function>)
Listen for an update!
event.
Parameter | Description |
---|---|
collection | keyword/string The collection. |
callback function | function A callback function that accepts three parameters: |
java.util.Date Time of event. | |
map Contains the id of the updated document, plus the fields that were updated. |
Examples
(defn update-event [time updated-fields]
; Do something
)
(on-update :coll update-event)
Listen for an `update!` event. | Parameter | Description | | --- | --- | | `collection` | `keyword/string` The collection. | | `callback function` | `function` A callback function that accepts three parameters: | | | `java.util.Date` Time of event. | | | `map` Contains the id of the updated document, plus the fields that were updated. | **Examples** ```Clojure (defn update-event [time updated-fields] ; Do something ) (on-update :coll update-event) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close