Skip to content

Documentation / @ember-data/legacy-compat / builders / queryRecord

Call Signature

ts
function queryRecord<T>(
   type, 
   query, 
options?): QueryRecordRequestInput<TypeFromInstance<T>, null | T>;

Defined in: builders/query.ts:97

This function builds a request config for a given type and query object. When passed to store.request, this config will result in the same behavior as a store.queryRecord request. Additionally, it takes the same options as store.queryRecord.

All @ember-data/legacy-compat builders exist to enable you to migrate your codebase to using the correct syntax for store.request while temporarily preserving legacy behaviors. This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers. To that end, these builders are deprecated and will be removed in a future version of Ember Data.

Type Parameters

T

T extends TypedRecordInstance

Parameters

type

TypeFromInstance<T>

the name of the resource

query

LegacyResourceQuery<T>

a query to be used by the adapter

options?

QueryOptions

optional, may include adapterOptions hash which will be passed to adapter.query

Returns

QueryRecordRequestInput<TypeFromInstance<T>, null | T>

request config

Deprecated

Call Signature

ts
function queryRecord(
   type, 
   query, 
   options?): QueryRecordRequestInput;

Defined in: builders/query.ts:102

This function builds a request config for a given type and query object. When passed to store.request, this config will result in the same behavior as a store.queryRecord request. Additionally, it takes the same options as store.queryRecord.

All @ember-data/legacy-compat builders exist to enable you to migrate your codebase to using the correct syntax for store.request while temporarily preserving legacy behaviors. This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers. To that end, these builders are deprecated and will be removed in a future version of Ember Data.

Parameters

type

string

the name of the resource

query

LegacyResourceQuery

a query to be used by the adapter

options?

QueryOptions

optional, may include adapterOptions hash which will be passed to adapter.query

Returns

QueryRecordRequestInput

request config

Deprecated

Released under the MIT License.