db._svc.FieldTypeService¶
Contains logic pertaining to FieldType objects: mongoose schema elements, calling to/fromDb function.
Todo
this is really low-level functionality probably not suitable for published API
-
fieldtypes.
init
()¶ Initialize FieldType cache from DB.
- Returns
promise – fullfilled upon completion of caching
-
augmentTypeDescMap
(tdm)¶ Augments a type descriptor map’s composites and arrays: flag composites, pull in definitions for named composites, and recursively process (Mutates the provided object; Used in initialization of BO Metadata.)
- Arguments
tdm (object) – type descriptor map to process
- Returns
object – the same object that was passed in
-
class
MongooseSchemaWrapper
()¶ - Arguments
textIndex (boolean) – indicates whether text index is configured for the FieldType
type (function) – the constructor object passed to mongoose
-
getSchemaElem
(typeDescriptor)¶ Convert typeDescriptor object from BOD into mongoose schema element.
- Arguments
typeDescriptor (object) – the type descriptor to convert
- Returns
MongooseSchemaWrapper – the object used by the Mongoose schema for a field w/ provided typeDescriptor
-
getFieldTypeHandler
(typeDescriptorOrId)¶ Get the actual FieldType object by ID or by type descriptor
- Arguments
typeDescriptorOrId (object|string) – type descriptor object or field type name
- Returns
FieldType –
-
processToDb
(modelObj)¶ Preprocess fields for persistence to mongo using the respective FieldType’s to_db function
- Arguments
modelObj (BusinessObject) – object to process
-
processFromDb
(modelObj)¶ Preprocess fields coming from mongo using the respective FieldType’s from_db function
- Arguments
modelObj (BusinessObject) – object to process