Table of Contents

Class DataObjectApiQuery

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll

Represents the ActualData Object query which is performed on Database Collection directly.

public class DataObjectApiQuery : DataApiQuery

Inheritance

objectDataApiQueryDataObjectApiQuery

Inherited Members

DataApiQuery.Filter, DataApiQuery.ProjectedFields, DataApiQuery.SortedFields, DataApiQuery.Take, DataApiQuery.Skip, DataApiQuery.SearchLimit, DataApiQuery.IncludeTotal, DataApiQuery.GeoSpatialStages, DataApiQuery.CustomCollation, DataApiQuery.HintIndexName, DataApiQuery.HintIndexForCount, DataApiQuery.MaxQueryTimeout, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Extension Methods

ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<DataObjectApiQuery>(DataObjectApiQuery)

Examples

var filter = FilterBuilder.Create().Eq("DepartmentId", ctx.Input.Id).Eq("Active", true).Build();
var query = DataObjectApiQuery.For("Employee")
    .FilterBy(filter)
    .ProjectOn("Username", "DepartmentId")
    .OrderBy("Firstname", true)
    .Paging(0, 10);
var result = ctx.Use<IDataApi>().Search(query);

Properties

DataClassName

The ActualData Class name.

public string DataClassName { get; set; }

Property Value

string

Methods

FilterBy(DynamicFilter)

Set query filter. For chaining purpose.

public DataObjectApiQuery FilterBy(DynamicFilter filter)

Parameters

filter DynamicFilter

The filter.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

FilterBy(object)

Set query filter. For chaining purpose.

public DataObjectApiQuery FilterBy(object filter)

Parameters

filter object

The filter.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

For(string)

Creates the query object.

public static DataObjectApiQuery For(string dataClassName)

Parameters

dataClassName string

The ActualData Class name.

Returns

DataObjectApiQuery

The query object.

GeoNear(string, GeoJsonObject, double?, double?)

Create a geospatial queries that find documents near a specific location, taking distance constraints into account.

public DataObjectApiQuery GeoNear(string field, GeoJsonObject value, double? maxDistance = 0, double? minDistance = 0)

Parameters

field string

This parameter specifies the name of the field in your documents that contains location data or coordinates.

value GeoJsonObject

A GeoJsonObject geometry for use with the following geospatial query operators.

maxDistance double?

This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.

minDistance double?

This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

GeoNearSphere(string, GeoJsonObject, double?, double?)

Create a geospatial query for finding documents near a specific geographic location, emphasizing spherical calculations.

public DataObjectApiQuery GeoNearSphere(string field, GeoJsonObject value, double? maxDistance = 0, double? minDistance = 0)

Parameters

field string

This parameter specifies the name of the field in your documents that contains location data or coordinates.

value GeoJsonObject

A GeoJsonObject geometry for use with the following geospatial query operators.

maxDistance double?

This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.

minDistance double?

This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

IncludeTotalItems(bool)

Determines whether Casewhere returns the total number of ActualData Objects. For chaining purpose.

public DataObjectApiQuery IncludeTotalItems(bool include)

Parameters

include bool

True means include.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

LimitSearch(int?)

When the limit is set, Casewhere will only process the search result within that limit, even when more data is found. If the limit is not set, Casewhere will use the SearchLimit configured in the web.config. This limit is applied for full-text search only.

public DataObjectApiQuery LimitSearch(int? limit)

Parameters

limit int?

The search limit.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

Near(string, double, double, double?, double?)

Create a geospatial queries that find documents near a specific location, taking distance constraints into account.

public DataObjectApiQuery Near(string field, double x, double y, double? maxDistance = 0, double? minDistance = 0)

Parameters

field string

This parameter specifies the name of the field in your documents that contains location data or coordinates.

x double

The parameter represent the longitude.

y double

The parameter represent the latitude.

maxDistance double?

This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.

minDistance double?

This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

NearSphere(string, double, double, double?, double?)

Create a geospatial query for finding documents near a specific geographic location, emphasizing spherical calculations.

public DataObjectApiQuery NearSphere(string field, double x, double y, double? maxDistance = 0, double? minDistance = 0)

Parameters

field string

This parameter specifies the name of the field in your documents that contains location data or coordinates.

x double

The parameter represent the longitude.

y double

The parameter represent the latitude.

maxDistance double?

This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.

minDistance double?

This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

OrderBy(string, bool)

Set query sorting. For chaining purpose.

public DataObjectApiQuery OrderBy(string name, bool asc = true)

Parameters

name string

The field name.

asc bool

Ascending or Descending.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

Paging(int, int)

Set query paging. For chaining purpose.

public DataObjectApiQuery Paging(int skip = 0, int take = 0)

Parameters

skip int

The number of ActualData Objects bypassed.

take int

The number of ActualData Objects returned.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

ProjectOn(params string[])

Set query projection. For chaining purpose.

public DataObjectApiQuery ProjectOn(params string[] fieldNames)

Parameters

fieldNames string[]

The projection.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

SetHintIndex(string)

Specify a hint index name for this query.

public DataObjectApiQuery SetHintIndex(string hintIndexName)

Parameters

hintIndexName string

The hint index name

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

SetHintIndexForCount(string)

Specify a hint index name for this counting query.

public DataObjectApiQuery SetHintIndexForCount(string hintIndexForCount)

Parameters

hintIndexForCount string

The hint index name

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

SetMaxQueryTimeout(int)

Specify max timeout for this query.

public DataObjectApiQuery SetMaxQueryTimeout(int maxQueryTimeout)

Parameters

maxQueryTimeout int

The max query timeout

Returns

DataObjectApiQuery

The query object itself for chaining purpose.

ToRuntimeQuery()

Convert DataObjectApiQuery to PagedDataObjectQuery. Ensure ProjectedFields has Id.

public virtual PagedDataObjectQuery ToRuntimeQuery()

Returns

PagedDataObjectQuery

Converted PagedDataObjectQuery from DataObjectApiQuery.

WithCustomCollation(string, int)

Specify a custom collation for this query. If not specified, the data source's collation will be used, if not specified too, the default collation will be used.

public DataObjectApiQuery WithCustomCollation(string collationLocale, int collationStrength)

Parameters

collationLocale string

This parameter specifies the locale of the custom collation.

collationStrength int

This parameter specifies the strengh of the custom collation.

Returns

DataObjectApiQuery

The query object itself for chaining purpose.