Liking cljdoc? Tell your friends :D

com.timezynk.mongo


aggregateclj

(aggregate coll pipeline)

MongoDB aggregation. coll - keyword/string: Collection name. pipeline - list(map): A list containing the request pipeline documents.

MongoDB aggregation.
coll     - keyword/string: Collection name.
pipeline - list(map): A list containing the request pipeline documents.
raw docstring

create-collection!clj

(create-collection! name)

create-index!clj

(create-index! coll keys & options)

Create an index for a collection. coll - keyword/string: Collection name. keys - map/list(keyword/string): A document or a list of keywords or strings. Optional parameters: background - boolean: Create the index in the background. name - string: A custom name for the index. partial-filter-expression - map: A filter expression for the index. sparse - boolean: Allow null values. unique - boolean: Index values must be unique.

Create an index for a collection.
coll - keyword/string: Collection name.
keys - map/list(keyword/string): A document or a list of keywords or strings.
Optional parameters:
  background                - boolean: Create the index in the background.
  name                      - string: A custom name for the index.
  partial-filter-expression - map: A filter expression for the index.
  sparse                    - boolean: Allow null values.
  unique                    - boolean: Index values must be unique.
raw docstring

delete!clj

(delete! coll query & options)

Delete matching documents. coll - keyword/string: The collection. query - map: A standard MongoDB query. Optional parameters: None yet.

Delete matching documents.
coll  - keyword/string: The collection.
query - map: A standard MongoDB query.
Optional parameters:
  None yet.
raw docstring

delete-one!clj

(delete-one! coll query & options)

Delete first matching document. coll - keyword/string: The collection. query - map: A standard MongoDB query. Optional parameters: None yet.

Delete first matching document.
coll  - keyword/string: The collection.
query - map: A standard MongoDB query.
Optional parameters:
  None yet.
raw docstring

drop-collection!clj

(drop-collection! coll)

drop-index!clj

(drop-index! coll index)

fetchclj

(fetch collection)
(fetch collection query :limit :only :skip :sort)

Fetch documents from collection.

coll - keyword/string: The collection.
query - map: A standard MongoDB query.
options - Optional parameters:
limit - int: Number of documents to fetch.
only - map: A MongoDB map of fields to include or exclude.
skip - int: Number of documents to skip before fetching.
sort - map: A MongoDB map of sorting criteria.

Fetch documents from collection.

coll    - keyword/string: The collection.  
query   - map: A standard MongoDB query.  
options - Optional parameters:  
  limit - int: Number of documents to fetch.  
  only  - map: A MongoDB map of fields to include or exclude.  
  skip  - int: Number of documents to skip before fetching.  
  sort  - map: A MongoDB map of sorting criteria.
raw docstring

fetch-and-delete!clj

(fetch-and-delete! coll query)

fetch-and-replace!clj

(fetch-and-replace! coll query doc & options)

fetch-and-update!clj

(fetch-and-update! coll query update & options)

fetch-countclj

(fetch-count coll)
(fetch-count coll query)

Count the number of documents returned. coll - keyword/string: The collection. query - map: A standard MongoDB query.

Count the number of documents returned.
coll  - keyword/string: The collection.
query - map: A standard MongoDB query.
raw docstring

fetch-oneclj

(fetch-one coll)
(fetch-one coll query)

Return only the first document retrieved. coll - keyword/string: The collection. query - map: A standard MongoDB query.

Return only the first document retrieved.
coll  - keyword/string: The collection.
query - map: A standard MongoDB query.
raw docstring

get-collectionsclj

(get-collections)

insert!clj

(insert! coll doc)

Add one document or a list thereof to a collection. coll - keyword/string: The collection. doc - map/list(map): A document or a list of documents.

Add one document or a list thereof to a collection.
coll - keyword/string: The collection.
doc  - map/list(map): A document or a list of documents.
raw docstring

list-indexesclj

(list-indexes coll)

replace-one!clj

(replace-one! coll query doc & options)

Replace a single document. coll - keyword/string: The collection. query - map: A standard MongoDB query. doc - map: The new document. Optional parameters: upsert? - boolean: If no document is found, create a new one. Default is don't create.

Replace a single document.
coll  - keyword/string: The collection.
query - map: A standard MongoDB query.
doc   - map: The new document.
Optional parameters:
  upsert? - boolean: If no document is found, create a new one. Default is don't create.
raw docstring

set-connection!clj

(set-connection! uri)

Procedurally set up or change mongodb connection. uri - string: database location.

Procedurally set up or change mongodb connection.
uri - string: database location.
raw docstring

set-database!clj

(set-database! db)

Procedurally set up or change database. db - string: name of database to use.

Procedurally set up or change database.
db - string: name of database to use.
raw docstring

transactioncljmacro

(transaction & body)

Functionally perform a transaction. Encapsulated database requests are queued and then atomically executed when the function goes out of scope.

Functionally perform a transaction. Encapsulated database requests are queued and then
atomically executed when the function goes out of scope.
raw docstring

update!clj

(update! coll query update & options)

Update matching documents. coll - keyword/string: The collection. query - map: A standard MongoDB query. update - map: A valid update document. Must use $set or $push. options - Optional parameters: upsert? - boolean: If no document is found, create a new one. Default is don't create.

Update matching documents.
coll    - keyword/string: The collection.
query   - map: A standard MongoDB query.
update  - map: A valid update document. Must use $set or $push.
options - Optional parameters:
  upsert? - boolean: If no document is found, create a new one. Default is don't create.
raw docstring

update-one!clj

(update-one! coll query update & options)

Update first matching document. coll - keyword/string: The collection. query - map: A standard MongoDB query. update - map: A valid update document. Must use $set or $push. options - Optional parameters: upsert? - boolean: If no document is found, create a new one. Default is don't create.

Update first matching document.
coll    - keyword/string: The collection.
query   - map: A standard MongoDB query.
update  - map: A valid update document. Must use $set or $push.
options - Optional parameters:
  upsert? - boolean: If no document is found, create a new one. Default is don't create.
raw docstring

with-dbcljmacro

(with-db db & body)

Functionally set up or change database. Reverts to earlier settings when leaving scope. db - string: name of database to use. body - encapsulated program calling the database.

Functionally set up or change database. Reverts to earlier settings when leaving scope.
db   - string: name of database to use.
body - encapsulated program calling the database.
raw docstring

with-mongocljmacro

(with-mongo uri db & body)

Functionally set up or change mongodb connection. Reverts to earlier settings when leaving scope.

parameterdescription
uristring database location.
dbstring database to use.
bodyencapsulated program utilizing the connection.
(with-mongo "mongodb://localhost:27017" "my-database"
  (insert! :users {:name "My Name"})
  (fetch! :users))
Functionally set up or change mongodb connection. Reverts to earlier settings when leaving scope.

| parameter | description |
| --- | --- |
| `uri` | `string` database location. |
| `db` | `string` database to use. |
| `body` | encapsulated program utilizing the connection. |

```Clojure
(with-mongo "mongodb://localhost:27017" "my-database"
  (insert! :users {:name "My Name"})
  (fetch! :users))
```
raw docstring

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

× close