You are reading the Orion 1.x documentation.
Version 1.x is no longer maintained. The current version is 2.x.
TypeScript SDK

Query Parameters

Learn how to include relations and work with soft deletes.

Including Relations

When building a query, you can instruct the API to include relations in the response.

const post = await Post.$query().with(['user', 'comments']).find(5); 

console.log(post.$relations.user);
console.log(post.$relations.comments);

Soft Deletes

Including Trashed Resources

const posts = await Post.$query().withTrashed().get();

Returning Only Trashed Resources

const posts = await Post.$query().onlyTrashed().get();