Liking cljdoc? Tell your friends :D
Clojure only.

com.timezynk.mongo.watch


on-insertclj

(on-insert <collection> <callback function>)

Listen for an insert! event.

ParameterDescription
collectionkeyword/string The collection.
callback functionfunction 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)
```
sourceraw docstring

on-updateclj

(on-update <collection> <callback function>)

Listen for an update! event.

ParameterDescription
collectionkeyword/string The collection.
callback functionfunction 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)
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close