Skip to main content

Query

Query Objectā€‹

TypeScript Support

A read model query has an associated TypeScript type:

  • Type Name - ReadModelQuery
  • Package - @resolve-js/core

A read model query object has the following structure:

{
modelName, // (string) The name of a read model.
resolverName, // (string) The name of a read model resolver.
resolverArgs, // (object) Specifies resolver arguments as key-value pairs.
jwt, // (string, optional) A JSON Web Token used to authorize the query.
}

Result Objectā€‹

TypeScript Support

A read model query result has an associated TypeScript type:

  • Type Name - ReadModelQueryResult
  • Package - @resolve-js/core

A read model query result can be a value of any serializable type depending on the implementation of the queried read model resolver:

common/read-models/shopping-lists.resolvers.js
const resolvers = {
all: async (store) => {
return await store.find('ShoppingLists', {}, null, { createdAt: 1 })
},
}
export default resolvers