I'am trying to build a query with loopback 4 with relation between 2 entities
customer.model.ts:
@model()
export class Customer extends Entity {
// id, name properties
@hasMany(() => Order)
orders?: Order[];
}
order.model.ts:
@model()
export class Order extends Entity {
// id, desc properties
@belongsTo(() => Customer)
customerId: Customer;
}
My goal is to get all cutomers that have at least 1 order but without selecting their orders, this my query
await customerRepository.find({
include: [{ relation: "orders" }],
});
I tried too :
await customerRepository.find({
include: [{ relation: "orders" }],
fields: {propertyName: }
});
Thank you for your help!