cbmongodb.Mongo

## Class Util

    lucee.Component
        cbmongodb.Mongo.Util

Mongo Util The utility methods used to assist in correct typing of objects passed to the MongoDB driver

Class Attributes:
- singleton : true
- 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` | jLoader CBJavaloader. access = public returntype = any inject = id:loader@cbjavaloader |  | `true` | `false`
`any` | MongoConfig access = public returntype = any inject = id:MongoConfig@cbmongodb |  | `true` | `false`

Method Summary
`any` | asArray([any dbResult]) Returns the results of a dbResult object as an array of documents.
`any` | createIndexOptions([any options]) Indexing Utilities.
`any` | createOrderedDBObject([any keyValues], [any dbObject=''])
`any` | dbObjectNew([any contents])
`any` | encapsulateDBResult([any dbResult])
`any` | ensureTypesInArray(any dboArray)
`any` | ensureTyping(any dbo)
`any` | getDateFromDoc([any doc]) Extracts the timestamp from the Doc's ObjectId.
`string` | getJLoader()
`string` | getMongoConfig()
`any` | isCFBasicDBObject([any doc]) Whether this doc is an instance of a CFMongoDB CFBasicDBObject.
`any` | isObjectId([string id])
`any` | isObjectIdString(any sId)
`any` | listToStruct([any list])
`numeric` | mapOrder(any order) SQL to Mongo translated ordering statements.
`any` | newDBObject() Create a new instance of the CFBasicDBObject.
`any` | newIDCriteriaObject([string id]) Convenience for creating a new criteria object based on a string _id.
`any` | newObjectIDFromID([string id]) Convenience for turning a string _id into a Mongo ObjectId object.
`any` | setJLoader(any jLoader)
`any` | setMongoConfig(any MongoConfig)
`any` | toCF([any BasicDBObject]) Converts a Mongo DBObject to a ColdFusion structure.
`any` | toMongo([any obj]) Converts a ColdFusion structure to a CFBasicDBobject, which the Java drivers can use.
`any` | toMongoDocument([any data])

Methods inherited from class `lucee.Component`
None

Property Detail

### jLoader

`property any jLoader`

CBJavaloader

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

### MongoConfig

`property any MongoConfig`

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

Method Detail

### asArray

`public any asArray([any dbResult])`

Returns the results of a dbResult object as an array of documents

Parameters:
  `dbResult`

### createIndexOptions

`public any createIndexOptions([any options])`

Indexing Utilities

Parameters:
  `options`

### createOrderedDBObject

`public any createOrderedDBObject([any keyValues], [any dbObject=''])`

Parameters:
  `keyValues`
  `dbObject`

### dbObjectNew

`public any dbObjectNew([any contents])`

Parameters:
  `contents`

### encapsulateDBResult

`public any encapsulateDBResult([any dbResult])`

Parameters:
  `dbResult`

### ensureTypesInArray

`public any ensureTypesInArray(any dboArray)`

Parameters:
  `dboArray`

### ensureTyping

`public any ensureTyping(any dbo)`

Parameters:
  `dbo`

### getDateFromDoc

`public any getDateFromDoc([any doc])`

Extracts the timestamp from the Doc's ObjectId. This represents the time the document was added to MongoDB

Parameters:
  `doc`

### getJLoader

`public string getJLoader()`

### getMongoConfig

`public string getMongoConfig()`

### isCFBasicDBObject

`public any isCFBasicDBObject([any doc])`

Whether this doc is an instance of a CFMongoDB CFBasicDBObject

Parameters:
  `doc`

### isObjectId

`public any isObjectId([string id])`

Parameters:
  `id`

### isObjectIdString

`public any isObjectIdString(any sId)`

Parameters:
  `sId`

### listToStruct

`public any listToStruct([any list])`

Parameters:
  `list`

### mapOrder

`public numeric mapOrder(any order)`

SQL to Mongo translated ordering statements

Parameters:
  `order`

### newDBObject

`public any newDBObject()`

Create a new instance of the CFBasicDBObject. You use these anywhere the Mongo Java driver takes a DBObject

### newIDCriteriaObject

`public any newIDCriteriaObject([string id])`

Convenience for creating a new criteria object based on a string _id

Parameters:
  `id`

### newObjectIDFromID

`public any newObjectIDFromID([string id])`

Convenience for turning a string _id into a Mongo ObjectId object

Parameters:
  `id`

### setJLoader

`public any setJLoader(any jLoader)`

Parameters:
  `jLoader`

### setMongoConfig

`public any setMongoConfig(any MongoConfig)`

Parameters:
  `MongoConfig`

### toCF

`public any toCF([any BasicDBObject])`

Converts a Mongo DBObject to a ColdFusion structure

Parameters:
  `BasicDBObject`

### toMongo

`public any toMongo([any obj])`

Converts a ColdFusion structure to a CFBasicDBobject, which the Java drivers can use

Parameters:
  `obj`

### toMongoDocument

`public any toMongoDocument([any data])`

Parameters:
  `data`