I am extracting the document where its status
is not equal to Finished, the below code works well.
const x = await rmm.Events.find(
{ status: { $ne: "Finished" } },
{ startTime: true, name: true, _id: false }
);
However, if I want to extract the status is not equal to Finished or Voided, the below code failed.
const x = await rmm.Events.find(
{ status: { $ne: ["Finished", "Voided"] } },
{ startTime: true, name: true, _id: false }
);
How should I fix it?
you have to use $nin
instead
const x = await rmm.Events.find(
{ status: { $nin: ["Finished", "Voided"] } },
{ startTime: true, name: true, _id: false }
);