(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 old-doc new-doc]
; 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 old-doc new-doc] ; Do something ) (on-update :coll update-event) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close