Mongodb – How to $match a field conditionally in mongo DB
I have the following schema: User: { ...otherFields, isDumb: false, type: "A" // could be "A", "B", or "C" } I want to fetch all dumb users by default and fetch by type only if the type is passed through…