Try $type operator to match specific type of field,
- match type by 2 ways first is
Number
and second is Alias
, where array type Number is 4 and Alias is "array"
const coursesWithArrayLocation = await Course.find({
location: { $type: "array" },
zipcode: { $exists: true }
})
Playground
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…