(delete! <database-file>)(delete! <bucket> <database-file>)Delete files in database. The function makes two or more database calls, one to fetch files info and one for each file deletion. These calls are not atomic. Wrap the function in a transaction to make them atomic.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
database-file | string File name. |
Returns
A count of matching files.
{:deleted-count <number of matching files>}
Delete files in database.
The function makes two or more database calls, one to fetch files info and one for each file deletion. These calls are not atomic. Wrap the function in a transaction to make them atomic.
| Parameter | Description
| --- | ---
| `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket.
| `database-file` | `string` File name.
**Returns**
A count of matching files.
```clojure
{:deleted-count <number of matching files>}
```(delete-by-id! <id>)(delete-by-id! <bucket> <id>)Delete file in database.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
id | ObjectId File id. |
Returns
A count of matching files.
{:deleted-count 1}
Delete file in database.
| Parameter | Description
| --- | ---
| `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket.
| `id` | `ObjectId` File id.
**Returns**
A count of matching files.
```clojure
{:deleted-count 1}
```(delete-by-query! <query>)(delete-by-query! <bucket>
<query>
&
:collation
<collation
object>
:limit <count>
:skip <count>
:sort {})Delete files in database. The function makes two or more database calls, one to fetch files info and one for each file deletion. These calls are not atomic. Wrap the function in a transaction to make them atomic.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
query | map A standard MongoDB query. Valid query keys are: |
:chunk-size Query on file chunk size. | |
:filename Query on file name. | |
:length Query on file length. | |
:metadata Query on file metadata. | |
:upload-date Query on file upload date. Default type is java.util.Date. | |
:collation | optional collation object Collation used for query. |
:limit | optional integer Number of documents to fetch for query. |
:skip | optional integer Number of documents to skip before deleting for query. |
:sort | optional map/list A map/list of sorting criteria for query. |
Returns
A count of matching files.
{:deleted-count <number of matching files>}
Delete files in database.
The function makes two or more database calls, one to fetch files info and one for each file deletion. These calls are not atomic. Wrap the function in a transaction to make them atomic.
| Parameter | Description
| --- | ---
| `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket.
| `query` | `map` A standard MongoDB query. Valid query keys are:
| | `:chunk-size` Query on file chunk size.
| | `:filename` Query on file name.
| | `:length` Query on file length.
| | `:metadata` Query on file metadata.
| | `:upload-date` Query on file upload date. Default type is `java.util.Date`.
| `:collation` | `optional collation object` Collation used for query.
| `:limit` | `optional integer` Number of documents to fetch for query.
| `:skip` | `optional integer` Number of documents to skip before deleting for query.
| `:sort` | `optional map/list` A map/list of sorting criteria for query.
**Returns**
A count of matching files.
```clojure
{:deleted-count <number of matching files>}
```(download! <database-file>)(download! <database-file> <output>)(download! <bucket> <database-file> <output> & :revision <integer>)Download a single file from database.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
database-file | string Name of file in database. |
output | string/stream/nil Disk file name or stream. If not set or nil, file will be stored to disk by its database name. |
:revision | optional integer File revision. |
Returns
nil.
Download a single file from database. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `database-file` | `string` Name of file in database. | `output` | `string/stream/nil` Disk file name or stream. If not set or `nil`, file will be stored to disk by its database name. | `:revision` | `optional integer` File revision. **Returns** `nil`.
(download-array! <database-file>)(download-array! <bucket> <database-file> & :revision <integer>)Download a single file from database to a byte array.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
database-file | string Name of file in database. |
:revision | optional integer File revision. |
Returns
Byte array.
Download a single file from database to a byte array. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `database-file` | `string` Name of file in database. | `:revision` | `optional integer` File revision. **Returns** Byte array.
(download-array-by-id! <id>)(download-array-by-id! <bucket> <id>)Download a single file from database to a byte array.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
id | ObjectId Id of file in database. |
Returns
Byte array.
Download a single file from database to a byte array. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `id` | `ObjectId` Id of file in database. **Returns** Byte array.
(download-by-id! <id>)(download-by-id! <id> <output>)(download-by-id! <bucket> <id> <output>)Download a single file from database.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
id | ObjectId Id of file in database. |
output | string/stream/nil Disk file name or stream. If not set or nil, file will be stored to disk by its database name. |
Returns
nil.
Download a single file from database. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `id` | `ObjectId` Id of file in database. | `output` | `string/stream/nil` Disk file name or stream. If not set or `nil`, file will be stored to disk by its database name. **Returns** `nil`.
(download-by-query! <query>)(download-by-query! <bucket>
<query>
&
:collation
<collation
object>
:limit <count>
:skip <count>
:sort {})Download files from database. The database file name will be used as disk file name.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
query | map A standard MongoDB query. Valid keys are: |
:chunk-size Query on file chunk size. | |
:filename Query on file name. | |
:length Query on file length. | |
:metadata Query on file metadata. | |
:upload-date Query on file upload date. Default type is java.util.Date. | |
:collation | optional collation object Collation used. |
:limit | optional integer Number of documents to fetch. |
:skip | optional integer Number of documents to skip before fetching. |
:sort | optional map/list A map/list of sorting criteria. |
Returns
nil.
Download files from database. The database file name will be used as disk file name. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `query` | `map` A standard MongoDB query. Valid keys are: | | `:chunk-size` Query on file chunk size. | | `:filename` Query on file name. | | `:length` Query on file length. | | `:metadata` Query on file metadata. | | `:upload-date` Query on file upload date. Default type is `java.util.Date`. | `:collation` | `optional collation object` Collation used. | `:limit` | `optional integer` Number of documents to fetch. | `:skip` | `optional integer` Number of documents to skip before fetching. | `:sort` | `optional map/list` A map/list of sorting criteria. **Returns** `nil`.
(info)(info <query>)(info <bucket>
<query>
&
:collation
<collation
object>
:limit <count>
:skip <count>
:sort {})Fetch files information.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
query | map A standard MongoDB query. Valid keys are: |
:chunk-size Query on file chunk size. | |
:filename Query on file name. | |
:length Query on file length. | |
:metadata Query on file metadata. | |
:upload-date Query on file upload date. Default type is java.util.Date. | |
:collation | optional collation object Collation used. |
:limit | optional integer Number of documents to fetch. |
:skip | optional integer Number of documents to skip before fetching. |
:sort | optional map/list A map/list of sorting criteria. |
Returns
A lazy sequence of matching documents.
Fetch files information. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `query` | `map` A standard MongoDB query. Valid keys are: | | `:chunk-size` Query on file chunk size. | | `:filename` Query on file name. | | `:length` Query on file length. | | `:metadata` Query on file metadata. | | `:upload-date` Query on file upload date. Default type is `java.util.Date`. | `:collation` | `optional collation object` Collation used. | `:limit` | `optional integer` Number of documents to fetch. | `:skip` | `optional integer` Number of documents to skip before fetching. | `:sort` | `optional map/list` A map/list of sorting criteria. **Returns** A lazy sequence of matching documents.
(rename! <database-file> <filename>)(rename! <bucket> <database-file> <filename>)Rename file(s) by name.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
database-file | string Name of file in database. |
filename | string New file name. |
Returns
nil.
Rename file(s) by name. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `database-file` | `string` Name of file in database. | `filename` | `string` New file name. **Returns** `nil`.
(rename-by-id! <id> <filename>)(rename-by-id! <bucket> <id> <filename>)Rename file by id.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
id | ObjectId Id of file in database. |
filename | string New file name. |
Returns
nil.
Rename file by id. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `id` | `ObjectId` Id of file in database. | `filename` | `string` New file name. **Returns** `nil`.
(upload! <input> <database-file>)(upload! <bucket> <input> <database-file> & :chunk-size <integer> :metadata {})Upload file to database.
| Parameter | Description |
|---|---|
bucket | keyword/string/nil The bucket name. If not set or nil use the default database bucket. |
input | string/byte[]/stream The input to store, either a file name, byte array, or input stream. |
database-file | string/nil File name to store in database. If not set or nil use the input string. |
:chunk-size | optional integer Chunk size in bytes. |
:metadata | optional map File metadata. |
:prune? | optional boolean Remove previous revisions. Default false. |
Returns
ObjectId of the created file.
Upload file to database. | Parameter | Description | --- | --- | `bucket` | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket. | `input` | `string/byte[]/stream` The input to store, either a file name, byte array, or input stream. | `database-file` | `string/nil` File name to store in database. If not set or `nil` use the input string. | `:chunk-size` | `optional integer` Chunk size in bytes. | `:metadata` | `optional map` File metadata. | `:prune?` | `optional boolean` Remove previous revisions. Default false. **Returns** `ObjectId` of the created file.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |