so I want to take a bills that's not been paid since last month and take a bills for this month so I have this query to check that
const pastBills = await Customer.find({
id_customer: (
await Meteran.find({
$and: [
{
id_usage: {
$nin: (await Bills.find()).map((bill) => bill.id_usage),
},
},
],
})
).map((meter) => meter.id_customer).length === 2,
});
I want to check which customer_id is the same with the customer_id in meteran that have two different id_usage that's not in the bills. but even thought I have two different id_usage that's not in the bills it returned an empty array can anyone help me to solve this?