Hello, I'm having a problem with my `tenants`.
When search for a product, I'm getting products from another tenant.
Is this an expected behaviour? What am I doing wrong?
export default query({
handler: async (ctx) => {
console.log("Write and test your query function here!");
return await ctx.db.query("products").withSearchIndex('by_name_and_tenant_and_deleted_and_is_active', (q) =>
q.search('name', "brigadeiro").eq('tenantId', "nx7bgjj6ras1r2ee9xnw6vv2nd7njke6" as any).eq('deleted', false).eq('isActive', true)
)
.take(10)
},
})export default query({
handler: async (ctx) => {
console.log("Write and test your query function here!");
return await ctx.db.query("products").withSearchIndex('by_name_and_tenant_and_deleted_and_is_active', (q) =>
q.search('name', "brigadeiro").eq('tenantId', "nx7bgjj6ras1r2ee9xnw6vv2nd7njke6" as any).eq('deleted', false).eq('isActive', true)
)
.take(10)
},
})[
{
_creationTime: 1755105877167.9624,
_id: "md7cfcf36pw857stmpdzxm3n8s7nj18a",
addons: [],
basePrice: 3.5,
category: "Doces unitários",
categoryId: "m17ft4pg7hd4kf97nkx2t8gap17nkszh",
cost: 0,
deleted: false,
description:
"Massa de brigadeiro de chocolate envolta em confeitos de açúcar em cores variadas.",
extras: [],
images: ["kg2dgpm4q2twfxfkqs6pxy5kfn7nkev9"],
isActive: true,
lastUpdated: 1755105877168,
name: "Brigadeiros unitários",
options: [],
recipes: [],
tenantId: "nx7afykk0qpbrk08w51yhe9rhn7njh79",
},
{
_creationTime: 1755105698925.9456,
_id: "md7d3pfqcqk4bcabvvq33f9tss7nk27c",
addons: [],
basePrice: 5,
category: "Doces unitários",
categoryId: "m17ft4pg7hd4kf97nkx2t8gap17nkszh",
cost: 0,
deleted: false,
description:
"Delicioso brigadeiro com granulado belga. Cerca de 20g.",
extras: [],
images: ["kg216es4ps5fd3pgj101ae2da97nkjqm"],
isActive: true,
lastUpdated: 1755105826778,
name: "Brigadeiros belga da Lili",
options: [],
recipes: [],
tenantId: "nx7afykk0qpbrk08w51yhe9rhn7njh79",
},
][
{
_creationTime: 1755105877167.9624,
_id: "md7cfcf36pw857stmpdzxm3n8s7nj18a",
addons: [],
basePrice: 3.5,
category: "Doces unitários",
categoryId: "m17ft4pg7hd4kf97nkx2t8gap17nkszh",
cost: 0,
deleted: false,
description:
"Massa de brigadeiro de chocolate envolta em confeitos de açúcar em cores variadas.",
extras: [],
images: ["kg2dgpm4q2twfxfkqs6pxy5kfn7nkev9"],
isActive: true,
lastUpdated: 1755105877168,
name: "Brigadeiros unitários",
options: [],
recipes: [],
tenantId: "nx7afykk0qpbrk08w51yhe9rhn7njh79",
},
{
_creationTime: 1755105698925.9456,
_id: "md7d3pfqcqk4bcabvvq33f9tss7nk27c",
addons: [],
basePrice: 5,
category: "Doces unitários",
categoryId: "m17ft4pg7hd4kf97nkx2t8gap17nkszh",
cost: 0,
deleted: false,
description:
"Delicioso brigadeiro com granulado belga. Cerca de 20g.",
extras: [],
images: ["kg216es4ps5fd3pgj101ae2da97nkjqm"],
isActive: true,
lastUpdated: 1755105826778,
name: "Brigadeiros belga da Lili",
options: [],
recipes: [],
tenantId: "nx7afykk0qpbrk08w51yhe9rhn7njh79",
},
]Is this an expected behaviour? What am I doing wrong?
