Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MongoDBFilterCompiler

MongoDBFilterCompiler provides a compiler for converting a valid search-filters string into a valid mongodb filter.

These filters are intended to be used with the mongodb package and may not work with more opinionated libraries.

Hierarchy

  • MongoDBFilterCompiler

Index

Constructors

Properties

Methods

Constructors

constructor

  • new MongoDBFilterCompiler(options?: Partial<Options>, policies?: AvailablePolicies, terms?: TermFactory<JSONXObject>): MongoDBFilterCompiler
  • Parameters

    • Default value options: Partial<Options> = {}
    • Default value policies: AvailablePolicies = {}
    • Default value terms: TermFactory<JSONXObject> = term.requiredTerms

    Returns MongoDBFilterCompiler

Properties

options

options: Partial<Options>

policies

policies: AvailablePolicies

terms

terms: TermFactory<JSONXObject>

Methods

compile

  • compile(enabled: EnabledPolicies, src: Source): Except<Object>
  • compile a Source string into a filter according to the EnabledPolicies provided.

    The EnabledPolicies can make use of the builtin availableProperties exported by using the key name instead of a Policy definition.

    The options and policies passed in the constructor are merged with the defaults to allow additional options and AvailablePolicies to be specified.

    Parameters

    • enabled: EnabledPolicies
    • src: Source

    Returns Except<Object>

toTerm

  • toTerm(enabled: EnabledPolicies, src: Source): Except<Term>
  • toTerm is an alternative to direct compilation.

    Instead of the compiled result a Term is produced that can be compiled later.

    Parameters

    • enabled: EnabledPolicies
    • src: Source

    Returns Except<Term>

Generated using TypeDoc