I have a Mongoose query for a Mongo instance where I have a DB which contains a bunch of records where I want to get all documents where the 'stripe.trialEnd' is older than the current time but where the 'stripe.isPaid' value is false. I wrote this query and it seems to select fine based on the isPaid value but will always pick up a value for the cutoff. I am looking for how I can get this query to work correctly.
let cutoff = new Date();
Company.find({'stripe.trialEnd': {$lt: cutoff}, 'stripe.isPaid': { '$in': ['false', false]} })
Example DB document
{
_id: <123abc>
stripe: {
isPaid: false,
trialEnd: 1608943761 // Epoch time
}
...
}
A similar post that I modeled my query after: Querying with mongoose and dates