Liking cljdoc? Tell your friends :D

com.timezynk.mongo.watch

Add call-back functions for listening to query events.

Add call-back functions for listening to query events.
raw docstring

on-deletecljmacro

(on-delete <collection> <callback function> & :full? <boolean>)

Listen for an update! event.

ParameterDescription
collectionkeyword/string/nil The collection. If nil it is set for the database.
callback functionfunction A callback function that accepts three parameters:
java.util.Date/custom Time of event, codec-dependent format.
map Contains either a single _id field with the id of the deleted document, or the entire deleted document.
:full?optional boolean (>= v6.0) Return complete deleted document.

Returns

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

Examples

(defn delete-event [coll time id]
  ; Do something
)

(on-delete :coll delete-event)
Listen for an `update!` event.

| Parameter           | Description
| ---                 | ---
| `collection`        | `keyword/string/nil` The collection. If `nil` it is set for the database.
| `callback function` | `function` A callback function that accepts three parameters:
|                     | `java.util.Date/custom` Time of event, codec-dependent format.
|                     | `map` Contains either a single `_id` field with the id of the deleted document, or the entire deleted document.
| `:full?`            | `optional boolean` (>= v6.0) Return complete deleted document.

**Returns**

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

**Examples**

```clojure
(defn delete-event [coll time id]
  ; Do something
)

(on-delete :coll delete-event)
```
sourceraw docstring

on-insertcljmacro

(on-insert <collection>
           <callback
           function>
           &
           :collation
           <collation
           object>
           :filter
           {})

Listen for an insert! event.

ParameterDescription
collectionkeyword/string/nil The collection. If nil it is set for the database.
callback functionfunction A callback function that accepts three parameters:
keyword The affected collection.
java.util.Date/custom Time of event, codec-dependent format.
map The inserted document.
:collationoptional collation object Collation used.
:filteroptional map Filter query.

Returns

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

Examples

(defn insert-event [coll time doc]
  ; Do something
)

(on-insert :coll insert-event)
Listen for an `insert!` event.

| Parameter           | Description
| ---                 | ---
| `collection`        | `keyword/string/nil` The collection. If `nil` it is set for the database.
| `callback function` | `function` A callback function that accepts three parameters:
|                     | `keyword` The affected collection.
|                     | `java.util.Date/custom` Time of event, codec-dependent format.
|                     | `map` The inserted document.
| `:collation`        | `optional collation object` Collation used.
| `:filter`           | `optional map` Filter query.

**Returns**

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

**Examples**

```clojure
(defn insert-event [coll time doc]
  ; Do something
)

(on-insert :coll insert-event)
```
sourceraw docstring

on-replacecljmacro

(on-replace <collection>
            <callback
            function>
            &
            :collation
            <collation
            object>
            :filter {}
            :full? <boolean>)

Listen for a replace! event.

ParameterDescription
collectionkeyword/string/nil The collection. If nil it is set for the database.
callback functionfunction A callback function that accepts three or four parameters:
java.util.Date/custom Time of event, codec-dependent format.
map The new document.
optional map The replaced document.
:collationoptional collation object Collation used.
:filteroptional map Filter query.
:full?optional boolean (>= v6.0) Return complete documents after and before change.

Returns

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

Examples

(defn update-event [coll time updated-fields]
  ; Do something
)

(on-update :coll update-event)
Listen for a `replace!` event.

| Parameter           | Description
| ---                 | ---
| `collection`        | `keyword/string/nil` The collection. If `nil` it is set for the database.
| `callback function` | `function` A callback function that accepts three or four parameters:
|                     | `java.util.Date/custom` Time of event, codec-dependent format.
|                     | `map` The new document.
|                     | `optional map` The replaced document.
| `:collation`        | `optional collation object` Collation used.
| `:filter`           | `optional map` Filter query.
| `:full?`            | `optional boolean` (>= v6.0) Return complete documents after and before change.

**Returns**

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

**Examples**

```clojure
(defn update-event [coll time updated-fields]
  ; Do something
)

(on-update :coll update-event)
```
sourceraw docstring

on-updatecljmacro

(on-update <collection>
           <callback
           function>
           &
           :collation
           <collation
           object>
           :filter {}
           :full? <boolean>)

Listen for an update! event.

ParameterDescription
collectionkeyword/string/nil The collection. If nil it is set for the database.
callback functionfunction A callback function that accepts three or four parameters:
keyword The affected collection.
java.util.Date/custom Time of event, codec-dependent format.
map Document with changed fields.
optional map Old document before changes.
:collationoptional collation object Collation used.
:filteroptional map Filter query.
:full?optional boolean (>= v6.0) Return complete documents after and before change.

Returns

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

Examples

(defn update-event [coll time updated-fields]
  ; Do something
)

(on-update :coll update-event)
Listen for an `update!` event.

| Parameter           | Description
| ---                 | ---
| `collection`        | `keyword/string/nil` The collection. If `nil` it is set for the database.
| `callback function` | `function` A callback function that accepts three or four parameters:
|                     | `keyword` The affected collection.
|                     | `java.util.Date/custom` Time of event, codec-dependent format.
|                     | `map` Document with changed fields.
|                     | `optional map` Old document before changes.
| `:collation`        | `optional collation object` Collation used.
| `:filter`           | `optional map` Filter query.
| `:full?`            | `optional boolean` (>= v6.0) Return complete documents after and before change.

**Returns**

Watch id, which is also the id of the watcher daemon thread. The id is used to close the watcher.

**Examples**

```clojure
(defn update-event [coll time updated-fields]
  ; Do something
)

(on-update :coll update-event)
```
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close