db._svc.QueryOpService¶
Funcationality around queries, query clauses and conditions
-
query.
init
()¶ Initialize service from QueryOp objects in the DB
- Returns
Promise – resolving when init complete
-
getQueryOpList
(forType)¶ Look up relevant QueryOps for a given type
- Arguments
forType (string) – field type
- Returns
Array.<QueryOp> –
-
satisfiesCondition
(modelObj, condition)¶ Evaluate a query condition against a model object
- Arguments
modelObj (BusinessObject) – object to evaluate against
condition (object) – the query condition
- Returns
true iff modelObj satisifes query condition
-
applyNoonianContext
(queryObj, context)¶ - Search for any $noonian_context objects within the queryObj, replace with values from actual context.
Keys mapping to an object such as {$noonian_context:’dotted.spec.string’} will be mapped to context.dotted.spec.string Mutates queryObj!
- Arguments
queryObj (object) –
context (object) –
- Returns
null –
-
queryToMongo
(queryObj, boMetaData)¶ Process any custom query operators to create a query for mongodb Mutates queryObj!
- Arguments
queryObj (object) –
boMetaData (object) –
- Returns
null –
-
stringifyQuery
(queryObj, boMetaData, fieldLabels, noonianContext)¶ Convert query object to human-readable string
- Arguments
queryObj (object) –
boMetaData (object) – bo_meta_data of object to which queryObj applies
fieldLabels (object) – map field name to label
noonianContext (object) – context to apply to labels
- Returns
string –