Liking cljdoc? Tell your friends :D

com.timezynk.mongo.files


delete!cljmacro

(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.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
database-filestring 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>}
```
raw docstring

delete-by-id!cljmacro

(delete-by-id! <id>)
(delete-by-id! <bucket> <id>)

Delete file in database.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
idObjectId 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}
```
raw docstring

delete-by-query!cljmacro

(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.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
querymap 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.
:collationoptional collation object Collation used for query.
:limitoptional integer Number of documents to fetch for query.
:skipoptional integer Number of documents to skip before deleting for query.
:sortoptional 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>}
```
raw docstring

download!cljmacro

(download! <database-file>)
(download! <database-file> <output>)
(download! <bucket> <database-file> <output> & :revision <integer>)

Download a single file from database.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
database-filestring Name of file in database.
outputstring/stream/nil Disk file name or stream. If not set or nil, file will be stored to disk by its database name.
:revisionoptional 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`.
raw docstring

download-arraycljmacro

(download-array <database-file>)
(download-array <bucket> <database-file> & :revision <integer>)

Download a single file from database to a byte array.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
database-filestring Name of file in database.
:revisionoptional 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.
raw docstring

download-array-by-idcljmacro

(download-array-by-id <id>)
(download-array-by-id <bucket> <id>)

Download a single file from database to a byte array.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
idObjectId 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.
raw docstring

download-by-id!cljmacro

(download-by-id! <id>)
(download-by-id! <id> <output>)
(download-by-id! <bucket> <id> <output>)

Download a single file from database.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
idObjectId Id of file in database.
outputstring/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`.
raw docstring

download-by-query!cljmacro

(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.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
querymap 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.
:collationoptional collation object Collation used.
:limitoptional integer Number of documents to fetch.
:skipoptional integer Number of documents to skip before fetching.
:sortoptional 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`.
raw docstring

download-streamcljmacro

(download-stream <database-file>)
(download-stream <bucket> <database-file> & :revision <integer>)

Create a stream for downloading a file.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
database-filestring Name of file in database.
:revisionoptional integer File revision.

Returns

Download stream.

Create a stream for downloading a file.

| 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**

Download stream.
raw docstring

download-stream-by-idcljmacro

(download-stream-by-id <id>)
(download-stream-by-id <bucket> <id>)

Create a stream for downloading a file.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
idObjectId Id of file in database.

Returns

Download stream.

Create a stream for downloading a file.

| 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**

Download stream.
raw docstring

drop-bucket!clj

(drop-bucket!)
(drop-bucket! bucket)

infocljmacro

(info)
(info <query>)
(info <bucket>
      <query>
      &
      :collation
      <collation
      object>
      :limit <count>
      :skip <count>
      :sort {})

Fetch files information.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
querymap 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.
:collationoptional collation object Collation used.
:limitoptional integer Number of documents to fetch.
:skipoptional integer Number of documents to skip before fetching.
:sortoptional 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.
raw docstring

rename!cljmacro

(rename! <database-file> <filename>)
(rename! <bucket> <database-file> <filename>)

Rename file(s) by name.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
database-filestring Name of file in database.
filenamestring 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`.
raw docstring

rename-by-id!cljmacro

(rename-by-id! <id> <filename>)
(rename-by-id! <bucket> <id> <filename>)

Rename file by id.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
idObjectId Id of file in database.
filenamestring 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`.
raw docstring

upload!cljmacro

(upload! <input> <database-file>)
(upload! <bucket>
         <input>
         <database-file>
         &
         :_id <ObjectId>
         :chunk-size <integer>
         :metadata {}
         :prune? <boolean>)

Upload file to database.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
inputstring/byte[]/stream The input to store, either a file name, byte array, or input stream.
database-filestring/nil File name to store in database. If not set or nil use the input string.
:_idoptional ObjectId Custom file id.
:chunk-sizeoptional integer Chunk size in bytes.
:metadataoptional 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.
| `:_id`          | `optional ObjectId` Custom file id.
| `: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.
raw docstring

upload-streamcljmacro

(upload-stream <database-file>)
(upload-stream <bucket>
               <database-file>
               &
               :_id <ObjectId>
               :chunk-size <integer>
               :metadata {})

Create a stream for uploading a file.

ParameterDescription
bucketkeyword/string/nil The bucket name. If not set or nil use the default database bucket.
database-filestring File name to store in database.
:_idoptional ObjectId Custom file id.
:chunk-sizeoptional integer Chunk size in bytes.
:metadataoptional map File metadata.

Returns

Upload stream.

Create a stream for uploading a file.

| Parameter       | Description
| ---             | ---
| `bucket`        | `keyword/string/nil` The bucket name. If not set or `nil` use the default database bucket.
| `database-file` | `string` File name to store in database.
| `:_id`          | `optional ObjectId` Custom file id.
| `:chunk-size`   | `optional integer` Chunk size in bytes.
| `:metadata`     | `optional map` File metadata.

**Returns**

Upload stream.
raw 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