ProjectionParams

Defines projection parameters with a list of fields to be included in the query results.

Extends: Array<string>

Description

The ProjectionParams class allows you to define projection parameters with a list of fields to be included in your query results.

Important points

  • The parameters support two formats: dot and nested.
  • The dot format is the standard way to define the included fields and subfields by using dot object notation. E.g. “field1,field2.field21,field2.field22.field221”.
  • As an alternative, the nested format offers a more compact representation. E.g. “field1,field2(field21,field22(field221))".

Constructors

Creates a new instance of the projection parameters and assigns its value.

public constructor(values: any[] = null)

  • values: any[] - (optional) values to initialize this object.

Instance methods

toString

Gets a string representation of the object. The result is a comma-separated list of projection fields “field1,field2.field21,field2.field22.field221”

public toString(): string

  • returns: string - a string representation of the object.

Static methods

fromString

Parses comma-separated list of projection fields.

public static fromString(…values: string[])

  • values: string[] - one or more comma-separated lists of projection fields
  • returns: ProjectionParams - a newly created ProjectionParams.

fromValue

Converts specified value into ProjectionParams.
See AnyValueArray.fromValue

public static fromValue(value: any): ProjectionParams

  • value: any - value to be converted
  • returns: ProjectionParams - a newly created ProjectionParams.

Examples

let filter = FilterParams.fromTuples("type", "Type1");
let paging = new PagingParams(0, 100);
let projection = ProjectionParams.fromString("field1,field2(field21,field22)")    

myDataClient.getDataByFilter(filter, paging, projection, (err, page) => {...});