new MongoDbSupport()

Description

Allows to export rules as a MongoDB find object as well as populating the builder from a MongoDB object.

Methods


getMongo( [ data ] ) → {object}

Description

Returns rules as a MongoDB query

Parameters
Name Type Attributes Description
data object <optional>

current rules by default

Returns
Throws

UndefinedMongoConditionError, UndefinedMongoOperatorError


getRulesFromMongo( query ) → {object}

Description

Converts a MongoDB query to rules

Parameters
Name Type Description
query object
Returns
Throws

MongoParseError, UndefinedMongoConditionError, UndefinedMongoOperatorError


setRulesFromMongo()

Description

Sets rules a from MongoDB query

Details

module:plugins.MongoDbSupport.getRulesFromMongo

Events


changer:getMongoDBField

Description

Modifies the MongoDB field used by a rule

Parameters
Name Type Description
field string
rule Rule
Returns

changer:getMongoDBFieldID

Description

Returns a filter identifier from the MongoDB field

Parameters
Name Type Description
field string
value *
Returns

changer:groupToMongo

Description

Modifies the MongoDB expression generated for a group

Parameters
Name Type Description
expression object
group Group
Returns

changer:mongoToGroup

Description

Modifies the group generated from the MongoDB expression

Parameters
Name Type Description
group object
expression object
Returns

changer:mongoToRule

Description

Modifies the rule generated from the MongoDB expression

Parameters
Name Type Description
rule object
expression object
Returns

changer:parseMongoNode

Description

Custom parsing of a MongoDB expression, you can return a sub-part of the expression, or a well formed group or rule JSON

Parameters
Name Type Description
expression object
Returns

expression, rule or group


changer:ruleToMongo

Description

Modifies the MongoDB expression generated for a rul

Parameters
Name Type Description
expression object
rule Rule
value *
valueWrapper function

function that takes the value and adds the operator

Returns