cbmongodb.Mongo

## Class GridFS

    lucee.Component
        cbmongodb.Mongo.GridFS

Mongo GridFS Processes Mongo GridFS Transactions

Class Attributes:
- license : Apache v2.0
- package : cbmongodb.models.Mongo
- synchronized : false
- accessors : true
- persistent : false
- author : Jon Clausen

Property Summary
type | property | default | serializable | required
--- | --- | --- | --- | ---
`any` | appSettings Application Settings. access = public returntype = any inject = wirebox:properties |  | `true` | `false`
`any` | bucketName access = public returntype = any |  | `true` | `false`
`any` | dbInstance Core GridFS connection properties. access = public returntype = any |  | `true` | `false`
`any` | GridInstance access = public returntype = any |  | `true` | `false`
`any` | jLoader CBJavaloader. access = public returntype = any inject = id:loader@cbjavaloader |  | `true` | `false`
`any` | mongoClient The Mongo Client Instance. access = public returntype = any inject = id:MongoClient@cbmongodb |  | `true` | `false`
`any` | mongoUtil Mongo Utils. access = public returntype = any inject = id:MongoUtil@cbmongodb |  | `true` | `false`

Constructor Summary
init([string db=''], [string bucket='fs']) Initialize The GridFS Instance.

Method Summary
`string` | createFile(string filePath, [string fileName], boolean deleteFile='false') Creates and stores a GridFS file.
`any` | find(struct criteria) Finds a file by search criteria.
`any` | findById(any id) Retreives a GridFS file by ObjectId.
`any` | findOne(struct criteria) Finds an returns a single document with search criteria.
`string` | getAppSettings()
`string` | getBucketName()
`string` | getDbInstance()
`any` | getFileList(struct criteria='[runtime expression]') Returns the iterative cursor of the files contained in the GridFS Bucket.
`string` | getGridInstance()
`string` | getJLoader()
`string` | getMongoClient()
`string` | getMongoUtil()
`private any` | isReadableImage([any filePath])
`any` | onDIComplete()
`any` | remove(struct criteria) Removes a GridFS file by criteria.
`any` | removeById(any id) Removes a GridFS file by id.
`any` | setAppSettings(any appSettings)
`any` | setBucketName(any bucketName)
`any` | setDbInstance(any dbInstance)
`any` | setGridInstance(any GridInstance)
`any` | setJLoader(any jLoader)
`any` | setMongoClient(any mongoClient)
`any` | setMongoUtil(any mongoUtil)

Methods inherited from class `lucee.Component`
None

Constructor Detail

### init

`public init([string db=''], [string bucket='fs'])`

Initialize The GridFS Instance

Parameters:
  `db`
  `bucket`

Property Detail

### appSettings

`property any appSettings`

Application Settings

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `inject` - wirebox:properties
  `serializable` - true

### bucketName

`property any bucketName`

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `serializable` - true

### dbInstance

`property any dbInstance`

Core GridFS connection properties

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `serializable` - true

### GridInstance

`property any GridInstance`

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `serializable` - true

### jLoader

`property any jLoader`

CBJavaloader

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `inject` - id:loader@cbjavaloader
  `serializable` - true

### mongoClient

`property any mongoClient`

The Mongo Client Instance

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `inject` - id:MongoClient@cbmongodb
  `serializable` - true

### mongoUtil

`property any mongoUtil`

Mongo Utils

Attributes:
  `access` - public
  `required` - false
  `returntype` - any
  `inject` - id:MongoUtil@cbmongodb
  `serializable` - true

Method Detail

### createFile

`public string createFile(string filePath, [string fileName], boolean deleteFile='false')`

Creates and stores a GridFS file

Parameters:
  `filePath`
  `fileName`
  `deleteFile`

Returns:
  string Returns the string representation of the file ID

### find

`public any find(struct criteria)`

Finds a file by search criteria

Parameters:
  `criteria`

### findById

`public any findById(any id)`

Retreives a GridFS file by ObjectId

Parameters:
  `id`

### findOne

`public any findOne(struct criteria)`

Finds an returns a single document with search criteria

Parameters:
  `criteria`

### getAppSettings

`public string getAppSettings()`

### getBucketName

`public string getBucketName()`

### getDbInstance

`public string getDbInstance()`

### getFileList

`public any getFileList(struct criteria='[runtime expression]')`

Returns the iterative cursor of the files contained in the GridFS Bucket

Parameters:
  `criteria`

### getGridInstance

`public string getGridInstance()`

### getJLoader

`public string getJLoader()`

### getMongoClient

`public string getMongoClient()`

### getMongoUtil

`public string getMongoUtil()`

### isReadableImage

`private any isReadableImage([any filePath])`

Parameters:
  `filePath`

### onDIComplete

`public any onDIComplete()`

### remove

`public any remove(struct criteria)`

Removes a GridFS file by criteria

Parameters:
  `criteria`

### removeById

`public any removeById(any id)`

Removes a GridFS file by id

Parameters:
  `id`

### setAppSettings

`public any setAppSettings(any appSettings)`

Parameters:
  `appSettings`

### setBucketName

`public any setBucketName(any bucketName)`

Parameters:
  `bucketName`

### setDbInstance

`public any setDbInstance(any dbInstance)`

Parameters:
  `dbInstance`

### setGridInstance

`public any setGridInstance(any GridInstance)`

Parameters:
  `GridInstance`

### setJLoader

`public any setJLoader(any jLoader)`

Parameters:
  `jLoader`

### setMongoClient

`public any setMongoClient(any mongoClient)`

Parameters:
  `mongoClient`

### setMongoUtil

`public any setMongoUtil(any mongoUtil)`

Parameters:
  `mongoUtil`