cbmongodb

Class BaseDocumentService

lucee.Component
    extended by cbmongodb.BaseDocumentService

Core MongoDB Document Service

Class Attributes:
  • attribute : string collection The name of the collection that the entity should map to
  •  
  • license : Apache v2.0
  •  
  • collection : default
  •  
  • package : cbmongodb.models
  •  
  • synchronized : false
  •  
  • database : test
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • author : Jon Clausen
  •  
    Property Summary
    type property default serializable required
    any _default_document
          The container for the default document.

    • access = public
    • returntype = any
    true false
    any _document
          package container for the active document entity.

    • access = public
    • returntype = any
    true false
    any _existing
          package container for the loaded document before modifications.

    • access = public
    • returntype = any
    true false
    any _id
          The id of the loaded document.

    • access = public
    • returntype = any
    true false
    any _map
          The schema map which will be persisted for validation and typing.

    • access = public
    • returntype = any
    true false
    any _validation
          Validation structure.

    • access = public
    • returntype = any
    • example = property name="myfield" schema=true validate="string";
    true false
    any appSettings
          The Coldbox Application Setttings Structure.

    • access = public
    • returntype = any
    true false
    any collection
          This key is maintained for backward compatibility but is marked as deprecated.

    • access = public
    • returntype = any
    • deprecated = true
    default true false
    any db
          The database client w/o a specified collection.

    • access = public
    • returntype = any
    true false
    any dbInstance
          The instatiated database collection to perform operations on.

    • access = public
    • returntype = any
    true false
    any logbox
          The LogBox Logger for this Entity.

    • access = public
    • returntype = any
    • inject = logbox:logger:{this}
    true false
    any MongoClient
          The MongoDB Client.

    • access = public
    • returntype = any
    • inject = id:MongoClient@cbmongodb
    true false
    any MongoIndexer
          The Mongo Indexer Object.

    • access = public
    • returntype = any
    • inject = id:MongoIndexer@cbmongodb
    true false
    any MongoUtil
          The Mongo Utilities Library.

    • access = public
    • returntype = any
    • inject = id:MongoUtil@cbmongodb
    true false
    any wirebox
          The Application Wirebox IOC Instance.

    • access = public
    • returntype = any
    • inject = wirebox
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    any append(string key, any value)
         Appends to an existing array schema property.
    any applyIndex(any prop, [any properties='[runtime expression]'])
         Create and apply our indexes.
    struct asStruct()
         Utility facade for getDocument().
    void criteria([struct criteria])
         Document Object Location, Searching and Query Utils ***************************************.
    any delete(any _id)
         Deletes a document by ID.
    any detect()
         Evaluate our properties for the default document.
    any evict()
         Evicts the document entity and clears the query arguments.
    void generateSchemaAccessors(struct prop)
         SETTERS **********************************.
    any get(any _id, [any returnInstance='true'])
         Load a record by _id.
    string get_default_document()
    string get_document()
    string get_existing()
    string get_id()
    string get_map()
    string get_validation()
    string getAppSettings()
    string getCollection()
    any getCollectionObject()
         Returns the Mongo.
    string getDb()
    string getDbInstance()
    struct getDocument()
         Returns a CFML copy of the loaded document.
    string getDocumentPath(string key)
         Returns the document path for a given property name or key.
    string getLogbox()
    string getMongoClient()
    string getMongoIndexer()
    string getMongoUtil()
    any getNormalizedData(string key)
         Returns the normalized data for a normalization key.
    any getPropertyDefault([any prop])
         Returns the default property value.
    string getWirebox()
    boolean hasExistingAccessor(string suffix)
    boolean isNormalizationKey(string key)
         Determines whether a property is a normalization key for another property.
    any load(any _id, [any returnInstance='true'])
         Alias for get().
    any locate([string key])
         Helper function to locate deeply nested document items.
    numeric mapOrder(any order)
         SQL to Mongo ordering translations.
    any normalizeOn(string key)
         Processes auto-normalization of a field.
    any populate(struct document)
         Populate the document object with a structure.
    any prepend(string key, any value)
         Prepends to an existing array property.
    any reset()
         reset the document state.
    any set(any key, any value)
         Sets a document property.
    any set_default_document(any _default_document)
    any set_document(any _document)
    any set_existing(any _existing)
    any set_id(any _id)
    any set_map(any _map)
    any set_validation(any _validation)
    any setAppSettings(any appSettings)
    any setCollection(any collection)
    any setDb(any db)
    any setDbInstance(any dbInstance)
    any setLogbox(any logbox)
    any setMongoClient(any MongoClient)
    any setMongoIndexer(any MongoIndexer)
    any setMongoUtil(any MongoUtil)
    any setWirebox(any wirebox)
    any toGeoJSON([array coordinates], [string type='Point'])
         Handles correct formatting of geoJSON objects.
    any toMongo(any arg)
         facade for Mongo.
    any toMongoDocument(struct arg)
         facade for Mongo.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Property Detail

    _default_document

    property any _default_document

    The container for the default document

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

    _document

    property any _document

    package container for the active document entity

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

    _existing

    property any _existing

    package container for the loaded document before modifications

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

    _id

    property any _id

    The id of the loaded document

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

    _map

    property any _map

    The schema map which will be persisted for validation and typing

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

    _validation

    property any _validation

    Validation structure

    Attributes:
    access - public
    required - false
    returntype - any
    example - property name="myfield" schema=true validate="string";
    serializable - true

    appSettings

    property any appSettings

    The Coldbox Application Setttings Structure

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

    collection

    property any collection = [default]

    This key is maintained for backward compatibility but is marked as deprecated. You should use the component attribute method to declare your collection name.

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

    db

    property any db

    The database client w/o a specified collection

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

    dbInstance

    property any dbInstance

    The instatiated database collection to perform operations on

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

    logbox

    property any logbox

    The LogBox Logger for this Entity

    Attributes:
    access - public
    required - false
    returntype - any
    inject - logbox:logger:{this}
    serializable - true

    MongoClient

    property any MongoClient

    The MongoDB Client

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

    MongoIndexer

    property any MongoIndexer

    The Mongo Indexer Object

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

    MongoUtil

    property any MongoUtil

    The Mongo Utilities Library

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

    wirebox

    property any wirebox

    The Application Wirebox IOC Instance

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

    Method Detail

    append

    public any append(string key, any value)

    Appends to an existing array schema property

    Parameters:
    key
    value

    applyIndex

    public any applyIndex(any prop, [any properties='[runtime expression]'])

    Create and apply our indexes

    Parameters:
    prop
    properties

    asStruct

    public struct asStruct()

    Utility facade for getDocument()


    criteria

    public void criteria([struct criteria])

    Document Object Location, Searching and Query Utils ***************************************

    Parameters:
    criteria

    delete

    public any delete(any _id)

    Deletes a document by ID

    Parameters:
    _id

    detect

    public any detect()

    Evaluate our properties for the default document


    evict

    public any evict()

    Evicts the document entity and clears the query arguments


    generateSchemaAccessors

    public void generateSchemaAccessors(struct prop)

    SETTERS **********************************

    Parameters:
    prop

    get

    public any get(any _id, [any returnInstance='true'])

    Load a record by _id

    Parameters:
    _id
    returnInstance

    get_default_document

    public string get_default_document()


    get_document

    public string get_document()


    get_existing

    public string get_existing()


    get_id

    public string get_id()


    get_map

    public string get_map()


    get_validation

    public string get_validation()


    getAppSettings

    public string getAppSettings()


    getCollection

    public string getCollection()


    getCollectionObject

    public any getCollectionObject()

    Returns the Mongo.Collection object for advanced operations facade for getDBInstance()


    getDb

    public string getDb()


    getDbInstance

    public string getDbInstance()


    getDocument

    public struct getDocument()

    Returns a CFML copy of the loaded document


    getDocumentPath

    public string getDocumentPath(string key)

    Returns the document path for a given property name or key

    Parameters:
    key

    getLogbox

    public string getLogbox()


    getMongoClient

    public string getMongoClient()


    getMongoIndexer

    public string getMongoIndexer()


    getMongoUtil

    public string getMongoUtil()


    getNormalizedData

    public any getNormalizedData(string key)

    Returns the normalized data for a normalization key

    Parameters:
    key

    getPropertyDefault

    public any getPropertyDefault([any prop])

    Returns the default property value Used to populate the document defaults

    Parameters:
    prop

    getWirebox

    public string getWirebox()


    hasExistingAccessor

    public boolean hasExistingAccessor(string suffix)

    Parameters:
    suffix

    isNormalizationKey

    public boolean isNormalizationKey(string key)

    Determines whether a property is a normalization key for another property

    Parameters:
    key

    load

    public any load(any _id, [any returnInstance='true'])

    Alias for get()

    Parameters:
    _id
    returnInstance

    locate

    public any locate([string key])

    Helper function to locate deeply nested document items

    Parameters:
    key
    Returns:
    any the value of the key or null if the key is not found

    mapOrder

    public numeric mapOrder(any order)

    SQL to Mongo ordering translations

    Parameters:
    order

    normalizeOn

    public any normalizeOn(string key)

    Processes auto-normalization of a field

    Parameters:
    key

    populate

    public any populate(struct document)

    Populate the document object with a structure

    Parameters:
    document

    prepend

    public any prepend(string key, any value)

    Prepends to an existing array property

    Parameters:
    key
    value

    reset

    public any reset()

    reset the document state


    set

    public any set(any key, any value)

    Sets a document property

    Parameters:
    key
    value

    set_default_document

    public any set_default_document(any _default_document)

    Parameters:
    _default_document

    set_document

    public any set_document(any _document)

    Parameters:
    _document

    set_existing

    public any set_existing(any _existing)

    Parameters:
    _existing

    set_id

    public any set_id(any _id)

    Parameters:
    _id

    set_map

    public any set_map(any _map)

    Parameters:
    _map

    set_validation

    public any set_validation(any _validation)

    Parameters:
    _validation

    setAppSettings

    public any setAppSettings(any appSettings)

    Parameters:
    appSettings

    setCollection

    public any setCollection(any collection)

    Parameters:
    collection

    setDb

    public any setDb(any db)

    Parameters:
    db

    setDbInstance

    public any setDbInstance(any dbInstance)

    Parameters:
    dbInstance

    setLogbox

    public any setLogbox(any logbox)

    Parameters:
    logbox

    setMongoClient

    public any setMongoClient(any MongoClient)

    Parameters:
    MongoClient

    setMongoIndexer

    public any setMongoIndexer(any MongoIndexer)

    Parameters:
    MongoIndexer

    setMongoUtil

    public any setMongoUtil(any MongoUtil)

    Parameters:
    MongoUtil

    setWirebox

    public any setWirebox(any wirebox)

    Parameters:
    wirebox

    toGeoJSON

    public any toGeoJSON([array coordinates], [string type='Point'])

    Handles correct formatting of geoJSON objects

    Parameters:
    coordinates
    type

    toMongo

    public any toMongo(any arg)

    facade for Mongo.Util.toMongo

    Parameters:
    arg

    toMongoDocument

    public any toMongoDocument(struct arg)

    facade for Mongo.Util.toMongoDocument

    Parameters:
    arg